Date: Tue, 7 Feb 1995 20:08:36 +0900 From: Stephen Turnbull To: djgpp AT sun DOT soe DOT clarkson DOT edu Subject: How to use Inf and NaN? > Another example: > x= 0.0 / 0.0 > also generates floating point example, but I need NaN in x. > > Is there any solution for this problem? > > Thanx in advance, > Pisti I haven't seen any replies posted, so, with much trepidation, I decided to take a look at this problem. That leaves assembly language, and modifying the FPU contol word to mask off certain exceptions, including divide by zero and whatever other conditions could result in a NaN. Then no exceptions will be generated. I think that this has been discussed on the list. Try searching the archives (see the URL below if you don't want to download the 8MB monster from Clarkson). Sure, it's dangerous, but what choice does he have if he wants efficient code (ie, having the FPU trap it)? state is, I believe, affine, but if you want to use the result as above maybe projective would be better???? I believe that affine means that there are plus and minus infinity; projective (like complex) only has one infinity. (That's what it means in math, IEEE definitions may be something else again.) So this is not going to return NaN. -- Stephen Turnbull / Yaseppochi-gumi / http://turnbull.sk.tsukuba.ac.jp/ anon FTP: turnbull.sk.tsukuba.ac.jp Check out Kansai-WWW, too ------------> http://pclsp2.kuicr.kyoto-u.ac.jp/