Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!mips!bridge2!jarthur!uci-ics!rfg From: rfg@ics.uci.edu (Ron Guilmette) Newsgroups: gnu.gcc Subject: Re: IEEE FLP question: Use of NAN and Inf Message-ID: <258EB169.7950@paris.ics.uci.edu> Date: 19 Dec 89 22:08:41 GMT References: <6788@tank.uchicago.edu> Reply-To: Ron Guilmette Organization: University of California, Irvine - Dept of ICS Lines: 33 In article <6788@tank.uchicago.edu> phd_ivo@gsbacd.uchicago.edu writes: > >Moreover, can someone please tell me how to define >the IEEE double's of +Inf, -Inf, and NaN, so that >I can assign and test for them? That's a damn good question, and one for which I would like an answer as well. The basic problem appears to be that there is no such thing as a "bitwise-verbatim" conversion in C (or in GCC). Thus, you cannot take an arbitrary bit pattern and do anything like the following: float f = (float) 0x80000000; without getting the (unwanted) effect of int => float conversion. I suggest that this problem may warrant a small syntax extension for GCC. How about if casts could include a trailing `=' to indicate "bitwise-verbatim" conversion. Thus: float f = (float = ) 0x80000000; Would give you an unmangled bit pattern in the mantle of a C float. This would allow you to implement either MACROs or const's for all of the Infinities, NaN's and other weird things that you would ever want or need. If this were to be implemented, it would seem reasonable to limit the use of this "bitwise-verbatim" casting to builtin floating-point types only. // rfg