floating point inconsistency

Andrew Haley aph@redhat.com
Wed Feb 17 15:07:00 GMT 2010


On 02/17/2010 02:43 PM, Andrew Haley wrote:
> On 02/17/2010 02:26 PM, Vincent Lefevre wrote:
>> On 2010-02-16 15:39:31 +0100, Christoph Groth wrote:
>>> Thank you all very much for clarifying this issue.  I am very much
>>> surprised that x87 instructions behave differently on AMD and Intel
>>> processors but this seems indeed to be the case.
>>
>> That's for elementary functions only (e.g. fsincos here). On
>>
>>   http://www.vinc17.net/research/testlibm/
>>
>> you can see that different platforms give different results.
>> Differencies may be due to the OS, the C library and/or the
>> hardware.
>>
>> Note that on x86_64 machines, sin and cos are correctly rounded
>> (this is not proved, but probably true in practice, assuming no
>> bugs in the implementation). I wonder why GCC doesn't use these
>> functions by default instead of glibc's sincos (which could be
>> enabled only with an option like -ffast-math).
> 
> Maybe this is a bug.  There is a version of sincos in the IBM Accurate
> Mathematical Library but it's not used in this case.

I misspoke.  There is a file there called sincos.c, but no sincos().
Seems to me like calling an inaccurate sincos() when the user tried 
to call an accurate sin() and cos() is surely a bug.

Andrew.



More information about the Gcc-help mailing list