Equality == comparisons with floating point numbers

Abdulhaq alynch4047 at gmail.com
Mon Dec 9 01:29:16 PST 2013


> To give context, you're talking about a comparison of
>
>      (a ^^ 2.0) * 1.0 + 0.0  == a ^^ 2.0
>
> (or, alternatively, the same but using isIdentical).
>
> I'm curious to confirm why placing writefln statements before 
> the isIdentical check should change its behaviour (I assume 
> flushing the FPU cache?) and whether this can be reliably done 
> without writing output to screen.
>

It's an interesting question. If I was attacking this problem I 
think I'd look at the assembly generated by the compiler, write a 
little self contained assembly program, and see if I could 
replicate it. I don't think it's a compiler problem - but what do 
I know!.


More information about the Digitalmars-d-learn mailing list