Article View: comp.os.os2.programmer
Article #3600Re: Floating point underflow
From: Dave Mooney
Date: Sun, 24 Jan 1993 23:02
Date: Sun, 24 Jan 1993 23:02
22 lines
1383 bytes
1383 bytes
In <1430.1034.uupcb@idcbbs.com> Claudio Fahey writes:
> I'm trying to write a program with the IBM C Set/2. Every
> once in a while, the program just terminates when I perform
> a specific action. IPMD ( the debugger ) tells me that it
> gets a floating point underflow on a line such as this:
> LONG rc; float Temp;
> rc = Temp * NUMCOLORS/MAXTEMP;
> When I trace into it, Temp is around 1e-40 and NUMCOLORS/MAXTEMP is
> around 0.93. Why is it giving me this error? Why doesn't it just
> set rc to 0? How can I avoid this problem? Thanks.
Underflow trapping is set on by default. To turn it off, add the
following line to your program:
_control87( EM_UNDERFLOW, EM_UNDERFLOW );
dave
-------------------------------------------------------------------------
Dave Mooney dmm@vnet.ibm.com
C Set/2 Development, IBM Canada Lab, 844 Don Mills Rd, Toronto, Ontario
"Now we can talk to cheese anywhere in the world!!!"
Technical Details
Message-ID:
<19930124.150334.898@almaden.ibm.com>Path:
arc1-ca.pugleaf.net!sparky!uunet!vnet.ibm.comReferences:
<1430.1034.uupcb@idcbbs.com>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!vnet.ibm.com From: dmm@vnet.ibm.com (Dave Mooney) Message-ID: <19930124.150334.898@almaden.ibm.com> Date: Sun, 24 Jan 93 18:02:15 EST Newsgroups: comp.os.os2.programmer Subject: Re: Floating point underflow Organization: IBM Canada Lab News-Software: UReply 3.0 References: <1430.1034.uupcb@idcbbs.com> Lines: 22