Dear Wiki user, You have subscribed to a wiki page or wiki category on "Stdcxx Wiki" for change notification.
The following page has been changed by MartinSebor: http://wiki.apache.org/stdcxx/FloatingPoint The comment on the change is: Copied relevant portions of C99. ------------------------------------------------------------------------------ = Floating Point Numbers, Infinities and NaNs = - In preparation for resolving [http://issues.apache.org/jira/browse/STDCXX-51 STDCXX-51] this page details the platform-specific details describing infinities and NaNs produced as the result of certain floating point calculations, usually triggered by invalid operands. + In preparation for resolving [http://issues.apache.org/jira/browse/STDCXX-51 STDCXX-51] this page outlines the platform-specific details describing infinities and NaNs produced as the result of certain floating point calculations, usually triggered by invalid operands. == libc symbols == + C99 specifies the following interface to infinities and NaNs: + + 7.12 Mathematics `<math.h>` + + -4- The macro `INFINITY` expands to a constant expression of type float representing positive or unsigned infinity, if available; else to a positive constant of type `float` that overflows at translation time. + + -5- The macro `NAN` is defined if and only if the implementation supports quiet NaNs for the `float` type. It expands to a constant expression of type float representing a quiet NaN. + + 7.12.11.2 The nan functions + + -1- Synopsis + + {{{ + #include <math.h> + double nan(const char *tagp); + float nanf(const char *tagp); + long double nanl(const char *tagp);}}} + + Description + + -2- The call `nan("`''n-char-sequence''`")` is equivalent to `strtod("NAN(`''n-charsequence''`)", (char**) NULL)`; the call `nan("")` is equivalent to `strtod("NAN()", (char**) NULL)`. If `tagp` does not point to an ''n-char sequence'' or an empty string, the call is equivalent to `strtod("NAN", (char**) NULL)`. Calls to `nanf` and `nanl` are equivalent to the corresponding calls to `strtof` and `strtold`. + + Returns + + -3- The nan functions return a quiet NaN, if available, with content indicated through `tagp`. If the implementation does not support quiet NaNs, the functions return zero. + - The table below lists the public symbols defined on each platform for Infinity, Quiet NaN, and Signaling NaN. + The table below lists the public symbols defined on each platform for Infinity, quiet NaN, and signaling NaN. ||||||||||||||||<tablestyle="background-color:cornsilk;text-align:center">'''libc symbols'''|| ||<rowstyle="background-color:lightgray"> || AIX || HP-UX || IRIX || Linux || Solaris || Tru64 UNIX || Windows ||