Version 11 of NaN

Updated 2007-09-28 09:17:47 by suchenwi

RS 2007-02-23: NaN is "Not a Number", a sort-of valid floating point value from Tcl 8.5. Here's experiments:

 (bin) 13 % set y [expr sqrt(-1)]
 -NaN
 (bin) 14 % expr {$y == $y} ;# the only value that is not equal to itself :^)
 0
 (bin) 15 % expr {$y eq $y}
 1

male 2007-02-23: Sorry, but using tclkit(sh)? 8.5a4 ...

 % expr {sqrt(-1)}
 domain error: argument not in valid range

RS I used tclkit 8.5a4 as well, on Win XP. So the patchlevel doesn't yet tell the full story :( Do the Inf examples work for you?

male yes, the Inf examples all work for me. But ... my tclkit(sh)? executables are bit older, some of the first built.

LV Okay, so I use the base-tcl8.5-thread-solaris-sparc (a tclkit) from ActiveTcl 8.5 beta (Tcl 8.5a5), as well as built myself the latest CVS head for Tcl 8.5a6 on SPARC Solaris. In both cases, I get the domain error, not the -NaN.


RS 2007-09-28: With 8.5b1 on WinXP, NaN is gone too :(

 % set n [expr sqrt(-1.)]
 domain error: argument not in valid range

See also expr - Inf


Category Glossary