floating point - nan initializers

Jarrett Billingsley kb3ctd2 at yahoo.com
Sun Feb 19 01:10:07 PST 2006


"Walter Bright" <newshound at digitalmars.com> wrote in message 
news:dt98cn$1ord$4 at digitaldaemon.com...
> Default initializing to nan is part of that - it forces the user to 
> *think* about what he wants the initial value to be. Initializing it by 
> default to 0 means that it can easilly be overlooked, and 0.0 can 
> introduce undetected, subtle errors in the result.

And most of the time, I *think* that I want it to be 0.  It's a rare 
occasion that I don't want it to be.  And I already explained that nan gives 
me more problems than 0 would - especially in systems where the values of 
the numbers aren't displayed in numerical form.

> There is a 'nan' value for pointers - null, a 'nan' value for UTF-8 
> chars - 0xFF - which is an illegal UTF-8 character. If there was a 'nan' 
> value for ints, D would use it as the default, too.

And so it is, then, that the two numerical types in D - integral and 
floating point - have two different initializers.  It makes no sense.

And again, I wonder to myself why I'm trying to convince you, because I know 
it won't happen.  I keep forgetting that one has to be named Don, Jill, or 
Matthew for one's suggestions to even be considered. 





More information about the Digitalmars-d mailing list