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