This is the mail archive of the
newlib@sourceware.org
mailing list for the newlib project.
Re: inaccuracy in cos()
It is time to scrap the mathfp functions altogether. The historical
intention at the time Ranjith created them was to try and create a
faster/leaner math library if a processor had good intrinsic
floating-point operations. However, some of the lean algorithms chosen
are doomed to inaccuracy (e.g. in this particular case, sin/cos use a
Taylor's series). I can imagine there are a whole lot more inaccuracy
errors yet undiscovered and IMO, it is not worth band-aiding so it is
time to simply retire it.
I'll look into adding other x86 fastmath routines when I get time.
-- Jeff J.
Martin Koeppe wrote:
Hi,
just found some inaccuracy in mathfp/cos(): cos(0.0) returns
0.999999999994129362690387097246 instead of 1.0. For 64-bit double
precision (53 bit mantissa, 18 decimal digits) this could be
considered as wrong.
Also I missed the fast assembler versions in machine/i386 of at least
sin(), cos(), and sqrt(). Assembler instructions exist for these since
at least i387 AFAIK.
Martin