Always false float comparisons
Ola Fosheim Grøstad via Digitalmars-d
digitalmars-d at puremagic.com
Sun May 15 12:03:40 PDT 2016
On Sunday, 15 May 2016 at 18:59:51 UTC, Ola Fosheim Grøstad wrote:
> On Sunday, 15 May 2016 at 18:41:57 UTC, Adam D. Ruppe wrote:
>> I suppose people figure if they use the same compiler, same
>> build options, same source code and feed the same data into
>> it, they expect to get the *same* results. It is a
>> deterministic machine, right?
>
> In this case it is worse, you get this:
>
> float f = some_pure_function();
> const float cf = some_pure_function();
>
> assert(cf==f); // SHUTDOWN!!!
That was too quick, but you get the idea:
assert((cf==N) == (f==N)); //SHUTDOWN!!
More information about the Digitalmars-d
mailing list