Float compare broke!

Matej Nanut matejnanut at gmail.com
Mon Jun 11 04:47:58 PDT 2012


On Monday, 11 June 2012 at 10:33:22 UTC, Era Scarecrow wrote:
>  Most curiously while making unittests the asserts fail when 
> I've confirmed it's working. The difference seems to be if it's 
> immutable/const vs non, and why this makes a difference I don't 
> see... Can someone give some light to this?
>
> const float i_f = 3.14159265;
> float a = i_f;
> float b = i_f;
> assert(a==b);    //passes
> assert(a==i_f);  //fails

Works for me.

(Arch Linux x64, DMD from repositories, says the version is 
2.059.)


More information about the Digitalmars-d-learn mailing list