Always false float comparisons
qznc via Digitalmars-d
digitalmars-d at puremagic.com
Mon May 9 07:52:44 PDT 2016
On Monday, 9 May 2016 at 12:24:05 UTC, John Colvin wrote:
> On Monday, 9 May 2016 at 11:26:55 UTC, Walter Bright wrote:
>> On 5/9/2016 3:16 AM, Jens Mueller via Digitalmars-d wrote:
>>> Warning for those comparisons should be fine. Shouldn't mix
>>> them anyway.
>>
>> Too onerous.
>
> Surely not too onerous if we're only talking about == ? Mixing
> floating point types on either side of == seems like a pretty
> solidly bad idea.
Why only == ? The example also applies to opCmp.
float f = 1.30;
assert(f >= 1.30);
assert(f <= 1.30);
More information about the Digitalmars-d
mailing list