Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!uunet!cs.utexas.edu!asuvax!ncar!tank!phd_ivo@gsbacd.uchicago.edu From: phd_ivo@gsbacd.uchicago.edu Newsgroups: gnu.gcc Subject: Re: IEEE FLP question: Use of NAN and Inf Message-ID: <6835@tank.uchicago.edu> Date: 21 Dec 89 18:24:25 GMT Sender: news@tank.uchicago.edu Organization: University of Chicago Graduate School of Business Lines: 25 > > Try > float f; > *(int*)&f = 0x80000000; > > this works on every c compiler I'm aware of. Yes, with floats, but not with doubles. Moreover, since it's not a preprocessor definition, its ugly when your code should read f=NaN; at some spot. The best ways to deal with these IEEE numbers (thanks for all the mail) are probably: #define NaN (0.0/0.0) #define Inf (1.0/0.0) #define isNaN (x!=x) One problem here is that I would like to generate a signal (exception/interupt) when an invalid operation is attempted. However, if this is possible on some computer(s), then the above definition will generate this upon assignment--- which is clearly not the intended result. /ivo