Sujet : Re: Radians Or Degrees?
De : mitchalsup (at) *nospam* aol.com (MitchAlsup1)
Groupes : comp.lang.c comp.archDate : 21. Mar 2024, 17:37:29
Autres entêtes
Organisation : Rocksolid Light
Message-ID : <d8269e715ac6557d4265337f425d29a1@www.novabbs.org>
References : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
User-Agent : Rocksolid Light
Michael S wrote:
On Thu, 21 Mar 2024 08:52:18 +0100
Terje Mathisen <terje.mathisen@tmsw.no> wrote:
MitchAlsup1 wrote:
Stefan Monnier wrote:
IIUC that was not the case before their work: it was "easy" to get
the correct result in 99% of the cases, but covering all 100% of
the cases used to be costly because those few cases needed a lot
more internal precision.
Muller indicates one typically need 2×n+6 to 2×n+12 bits to get
correct roundings 100% of the time. FP128 only has 2×n+3 and is
insufficient by itself.
I agree with everything else you've written about this subject, but afair, fp128 is using 1:15:112 while double is of course 1:10:53.
IEEE-754 binary64 is 1:11:52 :-)
But anyway I am skeptical about Miller's rules of thumb.
See Chapter 10 "Elementary Functions: Algorithms and Implementation"
Jean-Michael Muller {you can find a free copy on the net} and in
particular tables 10.5-10.14 -- quoting from the book::
"In his PhD dissertation [206], Lef`evre gives algorithms for finding the worst cases of the table maker’s dilemma. These algorithms use linear approximations and massive parallelism. A recent presentation of these algorithms, with some improvements, can be found in [207]. We have run Lef`evre’s algorithms to find worst cases in double-precision for the most common functions and domains. The results obtained so far, first published in [208] are given in Tables 10.5 to 10.14
They are NOT rules of thumb !! But go read it for yourself.
I'd expect that different transcendental functions would exercise
non-trivially different behaviors, mostly because they have different
relationships between input and output ranges. Some of them compress
wider inputs into narrower output and some do the opposite.
Yet another factor is luck.
Besides, I see nothing special about binary128 as a helper format.
It is not supported on wast majority of HW, And even when it is
supported, like on IBM POWER, for majority of operations it is slower
than emulated 128-bit fixed-point. Fix-point is more work for coder, but
sounds like more sure path to success.
On the one hand, 53*2+6 -> 112, on the other hand (if we include the hidden bits) we get 54*2+5 -> 113.
So significantly more than 2n+3 but not enough on its own to
guarantee correct rounding.
As Michael S have mentioned, we want these algorithms to work for vector/SIMD calculations, and at that point both lookup tables and widening the size of the temporaries are very costly.
Terje
>