From: ron@argus.lpl.Arizona.EDU (Ron Watkins)
Subject: NAN's on DEC
Date: 25 Jul 1994 15:37:47 GMT [thread overview]
Message-ID: <310m8b$k6v@news.CCIT.Arizona.EDU> (raw)
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 <stdio.h>
#include <ieeefp.h>
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.
reply other threads:[~1994-07-25 15:37 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox