From: "A.Appleyard" To: djgpp AT sun DOT soe DOT clarkson DOT edu Date: Fri, 24 Feb 1995 16:10:27 GMT Subject: dodging the INF-amous NaN-nygoat On Thu, 23 Feb 1995, Erwin Kok wrote: > ... I made up a program compiled it and it worked (under DJGPP FPU-emulation), but when I bought a co-processor, I compiled it and a strange floating-point exception appeared... After a few debugging hours I found that the result from an arithmetic statement was NAN (Not A Number) ... My advise is check if any variables are NAN's. Bill Davidson replied:- > A couple of weeks ago (?) someone posted a lovely little CTRL87.C program that allows one to diddle the '87 control word. It works like a charm and allows one to do just this sort of thing without resorting to asm. Again, please, either by re-posting this CTRL87.C program or in some other way, let the djgpp user be able to enter a state where floats and doubles that become INF or NaN are passed through arithmetic normally and don't make the program abort. I used to run on a CDC mainframe where I could do that, and it was very handy: 1/0=INF; 1/INF=0; 0/0=NaN; log(0)=-INF; exp(-INF)=0; etc.