MATH Error in MSC 5.0

Jim A. Pisano jap7g at psy3b2.psyc.Virginia.EDU
Wed Apr 6 23:55:35 AEST 1988


   I've written a simple keyboard-timing program in Microsoft C Ver. 5.0
which records when a keypress is made & the elapsed time between keypresses
in a given time period. I use the function 'ftime()' to get hours, minutes,
seconds, & milliseconds.  These times are then converted to  decimal hours
(I use doubles).
	Here's the problem:  The program runs fine, i.e. it calculates all of the
times & elapsed times correctly for the given time period, prints out the
results, & displays the message:
				run-time error M6101: MATH
				- floating-point error: invalid

The manual says that error M6101 results when an invalid operation occured.
This usually involves operating on a NAN (Not A Number) or infinity.  It
exits at that point with exit code 127.
	I've used Codeview without success on the routine that uses floating point
math & Codeview says that the program terminates normally with exit code 127.

Here are my questions: Can someone recognize this problem?  Where could it be
coming from? I have an 80287-equiped AT & have looked at the 80287 registers
with the '7' command, but I don't know enough about the 80287 to debug my
problem.

Please reply by e-mail, as I don't read comp.lang.c regularly.

Thanks in advance,

Jim Pisano



More information about the Comp.lang.c mailing list