elee24@castle.ed.ac.uk (H Bruce) (08/08/90)
I am working on a large program that has suddenly starting crashing with the following error: floating pointing exection M6101 invalid I tried to track the error down by using CodeView but compiling the program to prepare it for use by CodeView stops it crashing. After the program has been run and crashed a few times it starts to work and will not crash until the PC is rebooted. It will be alot of work (Edit - Compile - Run cycles) to insert printf() statements to track down the problem especially if it periodically disappears. So to give me a head start ..... does anyone know what is likely to cause this crash ? The manual says it is caused by operating on a NAN (not a number !) which is not much help. I have carefully casted all integer / float operations and checked parameter passing. The compiler gives me no warnings that are of use. Getting desparate..... Henry.
johnb@srchtec.UUCP (John Baldwin) (08/09/90)
In article <5587@castle.ed.ac.uk> elee24@castle.ed.ac.uk (H Bruce) writes: >I am working on a large program that has suddenly starting crashing with >the following error: > >floating pointing exection >M6101 invalid > [...deleted...] >The manual says it is caused by operating on a NAN (not a number !) which is >not much help. Can you post some code fragments that show what you're doing in floating point just prior to the error? To oversimplify, NAN is a representation chosen to provide more information than a simple underflow. A recent article in _IEEE_Computer_ suggested an enhanced FP representation including some extra values such as +RAIL and -RAIL (like an op-amp)... you might want to read it. In general, you've probably reached some kind of intermediate underflow or overflow condition if you're getting a NAN. QUESTION: are you using the fast-fp library, the 8087 emulator, or a real hardware 8087??? Maybe something isn't getting initialized right? -- John T. Baldwin | johnb@srchtec.uucp Search Technology, Inc. | johnb%srchtec.uucp@mathcs.emory.edu standard disclaimer: | ...uunet!samsung!emory!stiatl!srchtec.. opinions and mistakes purely my own. | ...mailrus!gatech!stiatl!srchtec...
steve@taumet.com (Stephen Clamage) (08/09/90)
NaN (not-a-number) is a well-defined concept in IEEE floating-point. Some arithmetic operations are undefined, such as 0.0 / 0.0 Infinity * 0.0 Infinity / Infinity Since no number can be the result of such an operation, NaN is the result. NaN and +/- Infinity each have a special bit pattern which is reserved for that use, and cannot be the result of any valid numerical operation. Infinity is usually the result of an overflow. Dividing by Infinity always results in zero (except for Infinity and NaN). The result of any operation involving a NaN is a NaN. That is, Infinities and NaNs propogate so that an expression which fails at some point during its evaluation doesn't suddenly wind up with an ordinary numerical value. So you may have some calculation which overflows, or otherwise has an invalid operation, possibly in an intermediate result. Floating-point expressions are not always evaluated in the order in which you expect, and intermediate overflows are possible. -- Steve Clamage, TauMetric Corp, steve@taumet.com
kdq@demott.COM (Kevin D. Quitt) (08/10/90)
In article <5587@castle.ed.ac.uk> elee24@castle.ed.ac.uk (H Bruce) writes: >I am working on a large program that has suddenly starting crashing with >the following error: > >floating pointing exection >M6101 invalid > >The manual says it is caused by operating on a NAN (not a number !) which is >not much help. I ran into the same problem, when I was getting binary data from another system - it was providing me with infinities. One way to handle it is to use signal( SIGFPE, your_function_here ) to catch the problem (don't forget to reset the signal inside your function). The approach I'm taking, since all my data comes in from the outside world, is to filter the data looking for NANs and Infinities. I check the value of the high order word (specifcally, the exponent of the fp value). 1) Mask off the high bit (sign of fraction) 2) Check to see if the value of the words exceeds the max given below If so, it's an infinity or a NAN. 3) If it's less than the min value below, and the rest of the FP value is non-zero, it's a denormalized number, and you probably don't wan't to much with it either. Max Min type value value float 7F80 0080 doble 7FF0 0010 extend 7FFF 0001 In any case, check out the 287 manual, or that for the 68881 - they've got the encodings there. Good luck! -- _ Kevin D. Quitt demott!kdq kdq@demott.com DeMott Electronics Co. 14707 Keswick St. Van Nuys, CA 91405-1266 VOICE (818) 988-4975 FAX (818) 997-1190 MODEM (818) 997-4496 PEP last 96.37% of all statistics are made up.