On Sunday, 15 May 2016 at 06:49:19 UTC, Ola Fosheim Grøstad wrote:
On Saturday, 14 May 2016 at 20:41:12 UTC, Era Scarecrow wrote:
The real reason it's false is because you're comparing against an immutable (constant), or my results lead me to believe that; Otherwise why could cf and If work?

The "immutable" is of type real... Unfortunately the "cf" is also computing as real whereas "f" is implicitly converted to real from float. It makes comparing floating point types for equality implementation defined in D, I.e. unreliable.

But the const and immutable still have to fit within the confines of the size provided, so the fact they were calculated as real doesn't matter when they are stored as floats. If all the results are inverted, I don't see how that works...

Although it does make sense that a float is being promoted up, and the lost precision vs the real is the problem... to which point it should issue a warning for different types.

Does this mean that instead for compares with a float/constant should be demoted down a level if it can? Although I'm sure using the f will force it to be correct.


But then why does f==If fail? It doesn't answer that critical question, since they should be identical.

Reply via email to