Always false float comparisons
Max Samukha via Digitalmars-d
digitalmars-d at puremagic.com
Sun May 15 22:49:06 PDT 2016
On Monday, 16 May 2016 at 04:02:54 UTC, Manu wrote:
> extended x = 1.3;
> x + y;
>
> If that code were to CTFE, I expect the CTFE to use extended
> precision.
> My point is, CTFE should surely follow the types and language
> semantics as if it were runtime generated code... It's not
> reasonable
> that CTFE has higher precision applied than the same code at
> runtime.
> CTFE must give the exact same result as runtime execution of
> the function.
>
You are not even guaranteed to get the same result on two
different x86 implementations. AMD64:
"The processor produces a floating-point result defined by the
IEEE standard to be infinitely precise.
This result may not be representable exactly in the destination
format, because only a subset of the
continuum of real numbers finds exact representation in any
particular floating-point format."
More information about the Digitalmars-d
mailing list