Always false float comparisons
Steven Schveighoffer via Digitalmars-d
digitalmars-d at puremagic.com
Mon May 9 13:47:31 PDT 2016
On 5/9/16 4:22 PM, Walter Bright wrote:
> On 5/9/2016 6:46 AM, Steven Schveighoffer wrote:
>> 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.
>
> Because it's yet another special case, and we know where those lead. For
> example, what if the 1.30 was the result of CTFE?
>
This is true, it's a contrived example.
-Steve
More information about the Digitalmars-d
mailing list