[Cuis-dev] Documentation for the different kinds of divisions
Andres Valloud
ten at smallinteger.com
Mon May 25 16:35:48 PDT 2020
Hi,
> It is also the implementation in Cuis :( . I guess we need a new
> primitive right? Maybe some simple math trick could give us the correct
> result?
OMG :facepalm:. Yeah, that's bad. The only correct way is to write a
primitive (other than implementing the C library in Smalltalk).
Not only you lose ulps that way, also some results will become zero when
they shouldn't. Plus, there is the issue of argument reduction.
> Still, it is not obvious to me. How far is this from the correct result?
Without properly massaging the arguments given to trigonometric
transcendentals, and without knowing what is really going on, you can
get a mantissa consisting of 15 leading non-zero bits, followed by 38
zero bits.
This is why *nobody* should be using the x87 anymore, and for the sake
of compatibility the best way is to delegate to some base math library
that everybody else uses (because then you get the optimized numerical
algorithm that will cause your answers to match their answers, and then
you have sanity). Unless of course you want to reimplement all of that
from scratch, and then Gilad's arguments start rising over the horizon
unless you have very good reasons.
Andres.
More information about the Cuis-dev
mailing list