type comparisons

BCS ao at pathlink.com
Sat Jan 26 10:36:41 PST 2008


Reply to Denton,

> Why does this throw these assert errors?
> both are thrown.
> All 3 - DMD 2.008/2.009/2.010
> 
> void main()
> {
> real x = 0.6584L;
> double y = 0.6584;
> assert(x == y);
> assert(cast(double)x == y);
> }

rounding error?

rounding 0.6584 (base 10) to real and then converting to double may round 
different than rounding it directly to double.




More information about the Digitalmars-d-learn mailing list