home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / lang / cplus / 11728 < prev    next >
Encoding:
Text File  |  1992-07-29  |  1.1 KB  |  32 lines

  1. Newsgroups: comp.lang.c++
  2. Path: sparky!uunet!taumet!steve
  3. From: steve@taumet.com (Steve Clamage)
  4. Subject: Re: NaN - magic value
  5. Message-ID: <1992Jul29.172252.5463@taumet.com>
  6. Organization: TauMetric Corporation
  7. References: <1992Jul29.084722.6906@cv.ruu.nl>
  8. Date: Wed, 29 Jul 1992 17:22:52 GMT
  9. Lines: 21
  10.  
  11. ger@cv.ruu.nl (Ger Timmens) writes:
  12.  
  13.  
  14. >I want to assign a magic value to certain double variables;
  15. >Currently I return DBL_MAX, as defined in <float.h>.
  16.  
  17. >Is it possible to assign the value NaN, to double variables ?
  18. >(NaN = NotANumber, e.g. dDouble = 1.0 / 0.0 ==> dDouble == NaN)
  19.  
  20. It depends entirely on the implementation of floating-point on your
  21. system.  Implementations are not required to supply NaN as a value
  22. or result, and if they do, they are allowed to generate a signal
  23. which you would have to catch.
  24.  
  25. Check the documentation for your system to see whether it uses NaN's,
  26. and how to use them.  I suggest you isolate any code using NaN to
  27. one module, since the code will not be portable.
  28. -- 
  29.  
  30. Steve Clamage, TauMetric Corp, steve@taumet.com
  31. Vice Chair, ANSI C++ Committee, X3J16
  32.