Ne.app NeANT
The Ne.app NeANT User module of the NeANT distribution.
Main Page
Related Pages
Topics
Namespaces
Data Structures
Files
File List
Globals
EXTERNAL_HEADERS
RSL
etc
config
src
QUIET_NAN.cpp
Go to the documentation of this file.
1
// checking for quiet NaN
2
3
25
#include <
stdlib.h
>
26
27
#include "config.h"
28
29
30
int
main
()
31
{
32
#ifdef _RWSTD_NO_DBL_TRAPS
33
34
// if floating point arithmetic doesn't trap, compute
35
// the result of (0.0 / 0.0) and exit successfully if
36
// the value of the result is a QNAN
37
38
char
*endptr = 0;
39
40
// NaN is never equal to another NaN
41
42
// compute NAN by 0.0 / 0.0 using strtod to foil optimizers
43
double
nan_1 = strtod (
"000"
, &endptr) / strtod (
"0.0"
, &endptr);
44
double
nan_2 = strtod (
"0.0"
, &endptr) / strtod (
"000"
, &endptr);
45
46
return
!(nan_1 != nan_2);
47
48
#else
// if defined (_RWSTD_NO_DBL_TRAPS)
49
50
// if floating point arithmetic traps assume QNAN exists
51
return
0;
52
53
#endif
// _RWSTD_NO_DBL_TRAPS
54
55
}
main
int main()
Definition
QUIET_NAN.cpp:30
stdlib.h
Generated by
1.9.8