[Issue 3632] modify float is float to do a bitwise compare

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Jun 27 20:45:12 PDT 2011


http://d.puremagic.com/issues/show_bug.cgi?id=3632



--- Comment #11 from yebblies <yebblies at gmail.com> 2011-06-27 20:40:16 PDT ---
(In reply to comment #10)
> I've been around numerics for 35 years now, and I've never seen a use for NaN
> payloads. I've never seen anyone even propose a use. Until then, I suspect
> supporting such would just cause problems.

This report has always been asking for a bitwise comparion, which is (as far as
I can tell) how every other type is treated by 'is'.

The use case I can remember being discussed is using 'v is float.init' to
determine if a floating point value is uninitialized or is a nan due to the
result of a calculation.

This seems to be the reason float.nan and float.init have different payloads in
the first place.

Currently this fails:

struct A { float f; }
A a;
A b;
b.f = float.nan;
assert((a is b) is (a.f is b.f));

Making 'is' for floating point types consistent with 'is' for other types seems
to me like a better move than introducing a new special case.

Maybe Steven or Don have an opinion on this feature they asked for?
'isIdentical' seems to do a straight bitwise comparison.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list