* NAN's on DEC
@ 1994-07-25 15:37 Ron Watkins
0 siblings, 0 replies; only message in thread
From: Ron Watkins @ 1994-07-25 15:37 UTC (permalink / 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.
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~1994-07-25 15:37 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1994-07-25 15:37 NAN's on DEC Ron Watkins
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox