float equality

spir denis.spir at gmail.com
Sat Feb 19 04:06:38 PST 2011


Hello,

What do you think of this?

unittest {
     assert(-1.1 + 2.2 == 1.1);          // pass
     assert(-1.1 + 2.2 + 3.3 == 4.4);    // pass
     assert(-1.1 + 3.3 + 2.2 == 4.4);    // fail
     assert(-1.1 + 3.3 == 2.2);          // fail
}

There is approxEquals in stdlib, right; but shouldn't builtin "==" be 
consistent anyway?

Denis
-- 
_________________
vita es estrany
spir.wikidot.com



More information about the Digitalmars-d mailing list