From: invalid AT erehwon DOT invalid (Graaagh the Mighty) Newsgroups: comp.os.msdos.djgpp Subject: Re: Mysterious NaNs... Organization: Low Charisma Anonymous Message-ID: <3b2b7829.177292197@news.primus.ca> References: <3b2b4290 DOT 163568911 AT news DOT primus DOT ca> <2561-Sat16Jun2001155617+0300-eliz AT is DOT elta DOT co DOT il> <3b2b5a7e DOT 169695543 AT news DOT primus DOT ca> <1190-Sat16Jun2001180202+0300-eliz AT is DOT elta DOT co DOT il> X-Newsreader: Forte Free Agent 1.11/32.235 Lines: 30 Date: Sat, 16 Jun 2001 15:18:53 GMT NNTP-Posting-Host: 207.176.153.13 X-Complaints-To: news AT primus DOT ca X-Trace: news1.tor.primus.ca 992686884 207.176.153.13 (Sat, 16 Jun 2001 06:21:24 EDT) NNTP-Posting-Date: Sat, 16 Jun 2001 06:21:24 EDT To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com On Sat, 16 Jun 2001 18:02:02 +0300, "Eli Zaretskii" sat on a tribble, which squeaked: >Why did you need to test for NaNs at all? Testing for a NaN is a bit >tricky, since it is defined to fail any test instruction. My advice >would be to avoid futzing with NaNs in the first place. > >Do you really have NaNs in your computations, and if so, is there a >way to get rid of them? They arise from some sort of overflow. It's easier just to let them accumulate and trap them. In any case, as you said they fail any test instruction -- even checking what should always be true, namely the square of a real number is non-negative. As for why to test for them every so often? The failure will be caught when the loop fails to converge after a maximal number of iterations, but a NaN appearing before that allows an earlier bailout, speeding it up. Also, I haven't determined the exact conditions for it to blow up. Sometimes the values got very large and overflowed, but I'm not sure about other times. Regardless of all of this, the fundamental problem stays unaddressed: a sequence of instructions is being misplaced by the optimizer. -- Bill Gates: "No computer will ever need more than 640K of RAM." -- 1980 "There's nobody getting rich writing software that I know of." -- 1980 "This antitrust thing will blow over." -- 1998 Combine neo, an underscore, and one thousand sixty-one to make my hotmail addy.