1*4b6b5744SDavid Schultz.\" Copyright (c) 2007 David Schultz <das@FreeBSD.org> 2*4b6b5744SDavid Schultz.\" All rights reserved. 3*4b6b5744SDavid Schultz.\" 4*4b6b5744SDavid Schultz.\" Redistribution and use in source and binary forms, with or without 5*4b6b5744SDavid Schultz.\" modification, are permitted provided that the following conditions 6*4b6b5744SDavid Schultz.\" are met: 7*4b6b5744SDavid Schultz.\" 1. Redistributions of source code must retain the above copyright 8*4b6b5744SDavid Schultz.\" notice, this list of conditions and the following disclaimer. 9*4b6b5744SDavid Schultz.\" 2. Redistributions in binary form must reproduce the above copyright 10*4b6b5744SDavid Schultz.\" notice, this list of conditions and the following disclaimer in the 11*4b6b5744SDavid Schultz.\" documentation and/or other materials provided with the distribution. 12*4b6b5744SDavid Schultz.\" 13*4b6b5744SDavid Schultz.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 14*4b6b5744SDavid Schultz.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 15*4b6b5744SDavid Schultz.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 16*4b6b5744SDavid Schultz.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 17*4b6b5744SDavid Schultz.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 18*4b6b5744SDavid Schultz.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 19*4b6b5744SDavid Schultz.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 20*4b6b5744SDavid Schultz.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 21*4b6b5744SDavid Schultz.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 22*4b6b5744SDavid Schultz.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 23*4b6b5744SDavid Schultz.\" SUCH DAMAGE. 24*4b6b5744SDavid Schultz.\" 25*4b6b5744SDavid Schultz.Dd December 16, 2007 26*4b6b5744SDavid Schultz.Dt NAN 3 27*4b6b5744SDavid Schultz.Os 28*4b6b5744SDavid Schultz.Sh NAME 29*4b6b5744SDavid Schultz.Nm nan , 30*4b6b5744SDavid Schultz.Nm nanf , 31*4b6b5744SDavid Schultz.Nm nanl 32*4b6b5744SDavid Schultz.Nd quiet \*(Nas 33*4b6b5744SDavid Schultz.Sh LIBRARY 34*4b6b5744SDavid Schultz.Lb libm 35*4b6b5744SDavid Schultz.Sh SYNOPSIS 36*4b6b5744SDavid Schultz.In math.h 37*4b6b5744SDavid Schultz.Ft double 38*4b6b5744SDavid Schultz.Fn nan "const char *s" 39*4b6b5744SDavid Schultz.Ft float 40*4b6b5744SDavid Schultz.Fn nanf "const char *s" 41*4b6b5744SDavid Schultz.Ft long double 42*4b6b5744SDavid Schultz.Fn nanl "const char *s" 43*4b6b5744SDavid Schultz.Sh DESCRIPTION 44*4b6b5744SDavid SchultzThe 45*4b6b5744SDavid Schultz.Dv NAN 46*4b6b5744SDavid Schultzmacro expands to a quiet \*(Na (Not A Number). 47*4b6b5744SDavid SchultzSimilarly, each of the 48*4b6b5744SDavid Schultz.Fn nan , 49*4b6b5744SDavid Schultz.Fn nanf , 50*4b6b5744SDavid Schultzand 51*4b6b5744SDavid Schultz.Fn nanl 52*4b6b5744SDavid Schultzfunctions generate a quiet \*(Na value without raising an invalid exception. 53*4b6b5744SDavid SchultzThe argument 54*4b6b5744SDavid Schultz.Fa s 55*4b6b5744SDavid Schultzshould point to either an empty string or a hexadecimal representation 56*4b6b5744SDavid Schultzof a non-negative integer (e.g., "0x1234".) 57*4b6b5744SDavid SchultzIn the latter case, the integer is encoded in some free bits in the 58*4b6b5744SDavid Schultzrepresentation of the \*(Na, which sometimes store 59*4b6b5744SDavid Schultzmachine-specific information about why a particular \*(Na was generated. 60*4b6b5744SDavid SchultzThere are 22 such bits available for 61*4b6b5744SDavid Schultz.Vt float 62*4b6b5744SDavid Schultzvariables, 51 bits for 63*4b6b5744SDavid Schultz.Vt double 64*4b6b5744SDavid Schultzvariables, and at least 51 bits for a 65*4b6b5744SDavid Schultz.Vt long double . 66*4b6b5744SDavid SchultzIf 67*4b6b5744SDavid Schultz.Fa s 68*4b6b5744SDavid Schultzis improperly formatted or represents an integer that is too large, 69*4b6b5744SDavid Schultzthen the particular encoding of the quiet \*(Na that is returned 70*4b6b5744SDavid Schultzis indeterminate. 71*4b6b5744SDavid Schultz.Sh COMPATIBILITY 72*4b6b5744SDavid SchultzCalling these functions with a non-empty string isn't portable. 73*4b6b5744SDavid SchultzAnother operating system may translate the string into a different 74*4b6b5744SDavid Schultz\*(Na encoding, and furthermore, the meaning of a given \*(Na encoding 75*4b6b5744SDavid Schultzvaries across machine architectures. 76*4b6b5744SDavid SchultzIf you understood the innards of a particular platform well enough to 77*4b6b5744SDavid Schultzknow what string to use, then you would have no need for these functions 78*4b6b5744SDavid Schultzanyway, so don't use them. 79*4b6b5744SDavid SchultzUse the 80*4b6b5744SDavid Schultz.Dv NAN 81*4b6b5744SDavid Schultzmacro instead. 82*4b6b5744SDavid Schultz.Sh SEE ALSO 83*4b6b5744SDavid Schultz.Xr fenv 3 , 84*4b6b5744SDavid Schultz.Xr ieee 3 , 85*4b6b5744SDavid Schultz.Xr isnan 3 , 86*4b6b5744SDavid Schultz.Xr math 3 , 87*4b6b5744SDavid Schultz.Xr strtod 3 88*4b6b5744SDavid Schultz.Sh STANDARDS 89*4b6b5744SDavid SchultzThe 90*4b6b5744SDavid Schultz.Fn nan , 91*4b6b5744SDavid Schultz.Fn nanf , 92*4b6b5744SDavid Schultzand 93*4b6b5744SDavid Schultz.Fn nanl 94*4b6b5744SDavid Schultzfunctions and the 95*4b6b5744SDavid Schultz.Dv NAN 96*4b6b5744SDavid Schultzmacro conform to 97*4b6b5744SDavid Schultz.St -isoC-99 . 98