Can we drop casts from float to bool?

bearophile bearophileHUGS at lycos.com
Wed Mar 24 13:26:57 PDT 2010


Paul D. Anderson:

>the coefficient and sign fields can be used as a "payload" for the NaN, containing diagnostic information, etc.<

They are the tagged NaNs. Do you know of a possible usage of them? :-)


> And, according to the General Decimal Arithmetic Specification (http://speleotrove.com/decimal) comparing NaN with any number, including another NaN, will never return true.<

(Note: I am not proposing of introducing "== nan" in D, that enhancement request is just about the "is" operator).
There are situations where you want to know if a number is any NaN (or if it's specifically the NaN used by D to initialize floats/reals/doubles). The std.math.isNaN() function is useful.

Bye,
bearophile



More information about the Digitalmars-d mailing list