www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - what does "-nan" mean

reply Tower Ty <towerty msn.com.au> writes:
It does not mean  "null" , it does not mean "0" , it does not mean "" so just
what does it signify

Not a number is cryptic . If it is not a number then just what is it ?
May 24 2008
next sibling parent janderson <askme me.com> writes:
Tower Ty wrote:
 It does not mean  "null" , it does not mean "0" , it does not mean "" so just
what does it signify
 
 Not a number is cryptic . If it is not a number then just what is it ?

It signifies that whatever was assigned to the value was "not a number". That is the program had no idea how to compute or assign a value given the input. Its really a sentinel to indicate error or un-assignment. -Joel
May 24 2008
prev sibling next sibling parent torhu <no spam.invalid> writes:
Tower Ty wrote:
 It does not mean  "null" , it does not mean "0" , it does not mean "" so just
what does it signify
 
 Not a number is cryptic . If it is not a number then just what is it ?

It's just a special bit pattern that floating point operations can result in when there's no sensible answer to put there. Like when you divide by zero, or do other illegal operations. If you do writefln(0/0.0), it will print 'nan'.
May 24 2008
prev sibling parent reply e-t172 <e-t172 akegroup.org> writes:
Tower Ty a écrit :
 It does not mean  "null" , it does not mean "0" , it does not mean "" so just
what does it signify
 
 Not a number is cryptic . If it is not a number then just what is it ?

http://en.wikipedia.org/wiki/NaN
May 25 2008
parent Tower Ty <towerty msn.com.au> writes:
e-t172 Wrote:

 Tower Ty a écrit :
 It does not mean  "null" , it does not mean "0" , it does not mean "" so just
what does it signify
 
 Not a number is cryptic . If it is not a number then just what is it ?

http://en.wikipedia.org/wiki/NaN

Thanks to you all . If we had a preferred answer system the above link would be the winner .
May 25 2008