2000-02-18 03:39:52 +08:00
|
|
|
/*
|
|
|
|
* nan () returns a nan.
|
|
|
|
* Added by Cygnus Support.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
FUNCTION
|
2003-10-21 02:46:38 +08:00
|
|
|
<<nan>>, <<nanf>>---representation of ``Not a Number''
|
2000-02-18 03:39:52 +08:00
|
|
|
|
|
|
|
INDEX
|
|
|
|
nan
|
|
|
|
INDEX
|
|
|
|
nanf
|
|
|
|
|
2017-11-30 16:36:17 +08:00
|
|
|
SYNOPSIS
|
2000-02-18 03:39:52 +08:00
|
|
|
#include <math.h>
|
2015-06-23 20:00:57 +08:00
|
|
|
double nan(const char *<[unused]>);
|
|
|
|
float nanf(const char *<[unused]>);
|
2000-02-18 03:39:52 +08:00
|
|
|
|
|
|
|
|
|
|
|
DESCRIPTION
|
|
|
|
<<nan>> and <<nanf>> return an IEEE NaN (Not a Number) in
|
2003-10-21 02:46:38 +08:00
|
|
|
double- and single-precision arithmetic respectively. The
|
2003-07-10 01:52:31 +08:00
|
|
|
argument is currently disregarded.
|
2000-02-18 03:39:52 +08:00
|
|
|
|
|
|
|
QUICKREF
|
|
|
|
nan - pure
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "fdlibm.h"
|
|
|
|
|
|
|
|
#ifndef _DOUBLE_IS_32BITS
|
|
|
|
|
2003-07-10 01:52:31 +08:00
|
|
|
double nan(const char *unused)
|
2000-02-18 03:39:52 +08:00
|
|
|
{
|
|
|
|
double x;
|
|
|
|
|
2014-03-21 Maciej W. Rozycki <macro@codesourcery.com>
* libc/stdlib/gd_qnan.h (f_QNAN, d_QNAN0, d_QNAN1): Add MIPS
versions.
(ld_QNAN0, ld_QNAN1, ld_QNAN2, ld_QNAN3): Don't define for MIPS.
(ldus_QNAN0, ldus_QNAN1, ldus_QNAN2, ldus_QNAN3, ldus_QNAN4):
Likewise.
* libc/stdlib/ldtoa.c (nan113, nan64, nan53, nan24): Add MIPS
versions.
(enan): Handle legacy MIPS payloads.
* libm/common/s_nan.c (nan): Use __builtin_nan if supported by
the compiler.
* libm/common/sf_nan.c (nanf): Likewise.
2014-03-22 05:27:29 +08:00
|
|
|
#if __GNUC_PREREQ (3, 3)
|
|
|
|
x = __builtin_nan("");
|
|
|
|
#else
|
2000-02-18 03:39:52 +08:00
|
|
|
INSERT_WORDS(x,0x7ff80000,0);
|
2014-03-21 Maciej W. Rozycki <macro@codesourcery.com>
* libc/stdlib/gd_qnan.h (f_QNAN, d_QNAN0, d_QNAN1): Add MIPS
versions.
(ld_QNAN0, ld_QNAN1, ld_QNAN2, ld_QNAN3): Don't define for MIPS.
(ldus_QNAN0, ldus_QNAN1, ldus_QNAN2, ldus_QNAN3, ldus_QNAN4):
Likewise.
* libc/stdlib/ldtoa.c (nan113, nan64, nan53, nan24): Add MIPS
versions.
(enan): Handle legacy MIPS payloads.
* libm/common/s_nan.c (nan): Use __builtin_nan if supported by
the compiler.
* libm/common/sf_nan.c (nanf): Likewise.
2014-03-22 05:27:29 +08:00
|
|
|
#endif
|
2000-02-18 03:39:52 +08:00
|
|
|
return x;
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* _DOUBLE_IS_32BITS */
|