Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!csus.edu!borland.com!alexande From: alexande@borland.com (Mark Alexander) Newsgroups: comp.sys.ibm.pc.hardware Subject: Re: Borland C and _8087/matherr bugs? HELP Keywords: Borland C FPU 8087 Message-ID: <1991May7.171822.10242@borland.com> Date: 7 May 91 17:18:22 GMT References: <2397@wet.UUCP> Organization: Borland International Lines: 21 In article <2397@wet.UUCP> smiller@wet.UUCP (Gregory Shane Miller) writes: >On a related issue, what gives with the matherr function? On my system, >the FPU is so slow that if my AT is in turbo mode the CLK FREQ to the >'287 causes wierd overflow errors. To test that, I wrote a 2 line program: > >double x,y; >main() >{ > y = (double).32432432; > x = y/M_PI; >} > >And when you run the program it terminates: Floating point error: overflow >*NOW* if I write my own matherr() function to catch any FP exceptions and >use the same code above - my matherr() is never called. OK - running the >poor chip too fast isn't too smart but why no consistency? The error message was printed by the FPU exception (NMI) handler in the library, not by matherr(). Matherr() handles errors for the math library (negative numbers passed to log(), etc.). You can trap FPU exceptions by using signal(SIGFPE,...).