home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / os / os2 / programm / 7974 < prev    next >
Encoding:
Internet Message Format  |  1993-01-24  |  1.3 KB

  1. Path: sparky!uunet!vnet.ibm.com
  2. From: dmm@vnet.ibm.com (Dave Mooney)
  3. Message-ID: <19930124.150334.898@almaden.ibm.com>
  4. Date: Sun, 24 Jan 93 18:02:15 EST
  5. Newsgroups: comp.os.os2.programmer
  6. Subject: Re: Floating point underflow
  7. Organization: IBM Canada Lab
  8. News-Software: UReply 3.0
  9. References: <1430.1034.uupcb@idcbbs.com>
  10. Lines: 22
  11.  
  12. In <1430.1034.uupcb@idcbbs.com> Claudio Fahey writes:
  13. > I'm trying to write a program with the IBM C Set/2.  Every
  14. > once in a while, the program just terminates when I perform
  15. > a specific action.  IPMD ( the debugger ) tells me that it
  16. > gets a floating point underflow on a line such as this:
  17. >     LONG rc; float Temp;
  18. >         rc = Temp * NUMCOLORS/MAXTEMP;
  19. >         When I trace into it, Temp is around 1e-40 and NUMCOLORS/MAXTEMP is
  20. >         around 0.93.  Why is it giving me this error?  Why doesn't it just
  21. >         set rc to 0?  How can I avoid this problem?  Thanks.
  22.  
  23. Underflow trapping is set on by default.  To turn it off, add the
  24. following line to your program:
  25.  
  26.   _control87( EM_UNDERFLOW, EM_UNDERFLOW );
  27.  
  28. dave
  29.  
  30. -------------------------------------------------------------------------
  31. Dave Mooney                                              dmm@vnet.ibm.com
  32.  C Set/2 Development, IBM Canada Lab, 844 Don Mills Rd, Toronto, Ontario
  33.           "Now we can talk to cheese anywhere in the world!!!"
  34.