Fix for bz#13658 - using fsincos on x86-64

Joseph S. Myers joseph@codesourcery.com
Wed Mar 7 15:25:00 GMT 2012


On Wed, 7 Mar 2012, Andreas Jaeger wrote:

> test-double fails with a lot of tests, starting with:
> testing double (without inline functions)
> Failure: Test: cos (M_PI_6l * 2.0) == 0.5
> Result:
>  is:          4.99861241344128237607e-01   0x1.ffdba01071a860000000p-2
>  should be:   5.00000000000000000000e-01   0x1.00000000000000000000p-1
>  difference:  1.38758655871762393019e-04   0x1.22ff7c72bd0000000000p-13
>  ulp       :  1249826861757.0000
>  max.ulp   :  1.0000
> 
> I need some more time to investigate this - and would appreciate any help,

One possibility is that the C implementations of sin and cos only work 
with rounding to 53 bits, not with x87 excess precision.  If so, then 
setting the FPU to 53-bit mode should help (and the libc_feupdateenv calls 
should handle restoring 64-bit mode), though some new macro would be 
needed to handle the environment setup for the affected functions (or 
you could have an i386 version of s_sin.c that includes headers, redefines 
libc_feholdexcept_setround then includes the main s_sin.c).

-- 
Joseph S. Myers
joseph@codesourcery.com



More information about the Libc-alpha mailing list