[comp.sys.ibm.pc] MATH Error in MS C 5.0

jap7g@psy3b2.psyc.Virginia.EDU (Jim A. Pisano) (04/06/88)

I'm writing a simple program that times keypresses using MicroSoft C V 5.0.
The times are obtained using the 'ftime()' functions.  I then convert the
times (in integer form) to floating point #'s (doubles) & display the 
times of keypresses & elapsed time between presses.
After the program runs (it runs correctly), I get the error:

run-time error M6101:  MATH
- floating-point error: invalid

The manual says that I tried to calculate infinity (I already know what
infinity is) or I operated on a NAN (Not A Number).

Here's my question: How can I find out where that NAN is?  I have CodeView,
but I haven't figured out how to trap this math error short of checking 
every variable everywhere.  Is there a way to set a tracepoint when the
math emulator is used?

Thanks,

Jim Pisano         Psychology Department   University of Virginia
jap7g@virginia

greg@csanta.UUCP (Greg Comeau) (04/09/88)

In article <734@virginia.acc.virginia.edu> jap7g@psy3b2.psyc.Virginia.EDU (Jim A. Pisano) writes:
>I get the error:
>run-time error M6101:  MATH
>- floating-point error: invalid
>
>Here's my question: How can I find out where that NAN is?  I have CodeView,
>but I haven't figured out how to trap this math error short of checking 
>every variable everywhere.  Is there a way to set a tracepoint when the

You might be able to find out by using the signal() function so that
it traps SIGFPE and jumps to one of your routines.