Always false float comparisons

Temtaime via Digitalmars-d digitalmars-d at puremagic.com
Mon May 9 05:29:14 PDT 2016


On Monday, 9 May 2016 at 12:28:04 UTC, Walter Bright wrote:
> On 5/9/2016 4:38 AM, Nordlöw wrote:
>> Would that include comparison of variables only aswell?
>>
>>     float f = 1.3;
>>     double d = 1.3;
>>     assert(f == d); // compiler warning
>
> No.

Just get rid of the problem : remove == and != from floats.


More information about the Digitalmars-d mailing list