Always false float comparisons

Timon Gehr via Digitalmars-d digitalmars-d at puremagic.com
Sat May 21 09:55:50 PDT 2016


On 17.05.2016 20:09, Max Samukha wrote:
> On Monday, 16 May 2016 at 19:01:19 UTC, Timon Gehr wrote:
>
>>> You are not even guaranteed to get the same result on two different x86
>>> implementations.
>>
>> Without reading the x86 specification, I think it is safe to claim
>> that you actually are guaranteed to get the same result.
>
> Correct. Sorry for the noise.

Interestingly, I was actually wrong:
https://hal.archives-ouvertes.fr/hal-00128124v5/document

I think that document is worth a read in any case.

Page 18: "Note, also, that different processors within the same 
architecture can implement the same transcendental functions with 
different accuracies. We already noted the difference between the AMD-K5 
and the K6 and following processors with respect to angular reduction. 
Intel also notes that the algorithms’ precision was improved between the 
80387 / i486DX processors and the Pentium processors. [Int, 1997,§7.5.10]"

The language should ideally not leak such differences to the user.


More information about the Digitalmars-d mailing list