Always false float comparisons

Iain Buclaw via Digitalmars-d digitalmars-d at puremagic.com
Sun May 15 23:09:06 PDT 2016


On 16 May 2016 at 06:06, Manu via Digitalmars-d
<digitalmars-d at puremagic.com> wrote:
> On 16 May 2016 at 14:05, Manu <turkeyman at gmail.com> wrote:
>> On 16 May 2016 at 13:03, Walter Bright via Digitalmars-d
>> <digitalmars-d at puremagic.com> wrote:
>>> On 5/15/2016 7:01 PM, Manu via Digitalmars-d wrote:
>>>>
>>>> Are you saying 'float' in CTFE is not 'float'? I protest this about as
>>>> strongly as I can muster...
>>>
>>>
>>> I imagine you'll be devastated when you discover that the C++ Standard does
>>> not require 32 bit floats to have 32 bit precision either, and never did.
>>>
>>> :-)
>>
>> I've never read the C++ standard, but I have more experience with a
>> wide range of real-world compilers than most, and it is rarely very
>> violated. The times it is, we've known about it, and it has made us
>> all very, very angry.
>
> Holy shit, it's just occurred to me that 'real' is only 64bits on arm
> (and every non-x86 platform)...
> That means a compiler running on an arm host will produce a different
> binary than a compiler running on an x86 host!! O_O

Which is why gcc/g++ (ergo gdc) uses floating point emulation.
Getting consistent results at compile time regardless of whatever
host/target/cross configuration trumps doing it natively.


More information about the Digitalmars-d mailing list