From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1164f8,5151741653585d10,start X-Google-Attributes: gid1164f8,public X-Google-ArrivalTime: 1994-07-25 08:49:55 PST Path: nntp.gmd.de!xlink.net!howland.reston.ans.net!usc!nic-nac.CSU.net!news.Cerritos.edu!news.Arizona.EDU!argus.lpl.Arizona.EDU!ron From: ron@argus.lpl.Arizona.EDU (Ron Watkins) Newsgroups: comp.sys.dec Subject: NAN's on DEC Date: 25 Jul 1994 15:37:47 GMT Organization: Lunar and Planetary Lab, U of AZ Distribution: world Message-ID: <310m8b$k6v@news.CCIT.Arizona.EDU> NNTP-Posting-Host: argus.lpl.arizona.edu Keywords: NAN I have need of generating both float and double NAN values for an application which im porting from a SUN computer. They both use IEEE 754 floating point representations so I thought this would be easy. I need to emulate the quite_nan() function available under SUN. I tried the following but it fails to produce NAN's for float's. So I can't proceed. Can anyone please help me out on generating NAN's on the DEC? ----------------------------------------------------------------------------- #include #include double dec_nan_d () { char c[8] = { 0xff, 0xff, 0xff, 0x7f, 0xff, 0xff, 0xff, 0xff }; return * (double *) & c[0]; } /* dec_nan_d */ float dec_nan_f () { char c[4] = { 0xff, 0xff, 0xff, 0x7f }; return * (float *) & c[0]; } /* dec_nan_f */ main () { float f; double d; f = dec_nan_f (); d = dec_nan_d (); printf ("Float NAN: %d\n", isnanf (f)); printf ("Double NAN: %d\n", isnand (d)); } ----------------------------------------------------------------------------- Please e-mail only to: ron@argus.lpl.arizona.edu -- Ron Watkins [ron@argus.lpl.arizona.edu] / /~~~~) / 931 Gould-Simpson / /____/ / University of Arizona / / / Tucson AZ. 85721 -- (602) 621-8606 (____ unar & / lanetary (____ ab.