[net.lang.c] How to test for +/- INFINITY, etc. i

david@ISM780.UUCP (12/31/85)

Using a constant like 0x7f800000 should jump  out  as  not  being
portable.  Even if it is hidden in a #define or a union.  

For a union of a float  and  a  long,  the  pdp11  and  vax  show
different  values  for  the  same  float  if the long is printed.
Also, there is no guarantee that the size of the float will match 
the size of the long.  Besides, 0x7f800000 is obviously wrong  on
the pdp11 and vax!  

It might be nice if machine dependent functions could be added to 
libc (3m) to detect not-a-nums and  plus  and  minus  infinities.
This seems to me to be where these guys belong.  

gwyn@BRL.ARPA (VLD/VMB) (01/01/86)

On UNIX System V, /usr/include/nan.h includes a definition of
NaN(X) for testing whether X is a Not-a-Number, and KILLNaN(X)
to generate a SIGFPE if X ditto.  If you're going to invent
macros, please follow this existing model rather than diverge.