[Cuis-dev] Documentation for the different kinds of divisions
Nicolas Cellier
nicolas.cellier.aka.nice at gmail.com
Mon May 25 22:13:39 PDT 2020
Hi all,
No time to answer to the whole thread now...
FYI, Eliot has resurrected fdlibm math library for Terf, so we should
benefit from platform independent results and faithfully rounded results
soon... It's not perfect, but it's good enough.
For ratio:/residue: I agree, i fall short of vocabulary... It would be
named remainder: and quotient: to ressemble iso names, but proximity to
quo/rem disqualified this choice.
Le mar. 26 mai 2020 à 04:45, Andres Valloud via Cuis-dev <
cuis-dev at lists.cuis.st> a écrit :
> Yeah, it's bad. For example,
>
> Float halfPi successor cos
>
> is positive, and therefore (since there's no tan primitive either)
>
> Float halfPi successor tan
>
> is positive. Sample C programs produce sensible output instead.
>
> Some experiments show that doing argument reduction towards zero
> minimizes error. However, this is just a hack that illustrates the
> brittleness of the system: improving the argument reduction for cos
> causes the arcTan test to never finish because its iteration no longer
> converges. This shows the poor behavior of cos is baked in already.
>
> On the one hand, who cares about a few ulps, right? On the other hand,
> whoever is careless with the truth in small matters cannot be trusted
> with important matters.
>
> Short of reimplementing a math library from scratch, the best way to do
> transcendentals is with primitives that call the platform libraries
> everyone else uses. Doing this properly should not be hard.
>
> On 5/25/20 16:35, Andres Valloud via Cuis-dev wrote:
> > 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.
> --
> Cuis-dev mailing list
> Cuis-dev at lists.cuis.st
> https://lists.cuis.st/mailman/listinfo/cuis-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20200526/6b452790/attachment.htm>
More information about the Cuis-dev
mailing list