home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / lang / c / 13047 < prev    next >
Encoding:
Internet Message Format  |  1992-08-31  |  606 b 

  1. Path: sparky!uunet!cs.utexas.edu!sdd.hp.com!uakari.primate.wisc.edu!ames!network.ucsd.edu!ucsbcsl!ucsbuxa!6500mack
  2. From: 6500mack@ucsbuxa.ucsb.edu (Michael P. Mack)
  3. Newsgroups: comp.lang.c
  4. Subject: How is NaN recognized?  (solved)
  5. Message-ID: <5585@ucsbcsl.ucsb.edu>
  6. Date: 1 Sep 92 02:05:08 GMT
  7. Sender: root@ucsbcsl.ucsb.edu
  8. Lines: 14
  9.  
  10. Thanks for all the responses.
  11.  
  12. The simplest solution to this problem was suggested by
  13. Larry Jones of SDRC (lawrence.jones@sdrc.com)
  14.  
  15. By checking the return value of scanf(), it is easy to
  16. tell when it has failed:
  17.  
  18.     if (scanf("%f",&value) == EOF)
  19.       value = 0.0;
  20.  
  21.  
  22. Mike
  23.  
  24.