How to test for +/- INFINITY, etc. i

david at ISM780.UUCP david at ISM780.UUCP
Tue Dec 31 09:37:00 AEST 1985


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.  



More information about the Comp.lang.c mailing list