Always false float comparisons

Walter Bright via Digitalmars-d digitalmars-d at puremagic.com
Sun May 15 19:56:34 PDT 2016


On 5/15/2016 7:04 PM, Manu via Digitalmars-d wrote:
>> I understand there are some cases where this is needed, I've proposed
>> intrinsics for that.
> Intrinsics for... what?

    float roundToFloat(float f);


> I really don't want to use an intrinsic to have float behave like a
> float at CTFE... nobody will EVER do that.

Floats aren't required to have float precision by the C or C++ Standards. I 
quoted it for Ola :-)


>> It's 128 bits on other CPUs.
> What?

Some CPUs have 128 bit floats.


>>> This sounds like designing specifically for my problem from above,
>>> where the frontend is always different than the backend/runtime.
>>> Please have the frontend behave such that it operates on the precise
>>> datatype expressed by the type... the backend probably does this too,
>>> and runtime certainly does; they all match.
>>
>>
>> Except this never happens anyway.
>
> Huh? I'm sorry, I didn't follow those points.

The belief that compile time and runtime are exactly the same floating point in 
C/C++ is false.


More information about the Digitalmars-d mailing list