On 5/9/16 7:26 AM, Walter Bright wrote:
I wonder what's the difference between 1.30f and cast(float)1.30.

There isn't one.

I know this is a bit band-aid-ish, but if one is comparing literals to a float, why not treat the literal as the type being compared against? In other words, imply the 1.3f. This isn't integer-land where promotions do not change the outcome.

What I see here is that double(1.3) cannot be represented as a float. So right there, the compiler can tell you, no, this is never going to be true. Something stinks when you can write an always-false expression as an if conditional by accident.

-Steve

Reply via email to