Always false float comparisons
Seb via Digitalmars-d
digitalmars-d at puremagic.com
Sun May 15 16:16:01 PDT 2016
On Sunday, 15 May 2016 at 22:49:27 UTC, Walter Bright wrote:
> On 5/15/2016 2:06 PM, Ola Fosheim Grøstad wrote:
>> The net result is that adding const/immutable to a type can
>> change the semantics
>> of the program entirely at the whim of the compiler
>> implementor.
>
> C++ Standard allows the same increased precision, at the whim
> of the compiler implementor, as quoted to you earlier.
>
> What your particular C++ compiler does is not relevant, as its
> behavior is not required by the Standard.
>
I am watching this conversation for quite a while now and it's
interesting to see how we went from the problem
float f = 1.30;
assert(f == 1.30); // NO
assert(f == cast(float)1.30); //OK
to this (endless) discussion.
> My proposal removes the "whim" by requiring 128 bit precision
> for CTFE.
@Walter: I think this is a great idea and increased precision is
always better!
As you pointed out, yes the only reason to decrease precision if
a trade-off for speed. Please keep doing/pushing this!
More information about the Digitalmars-d
mailing list