1*9f1be2b6Stb.\" $OpenBSD: nan.3,v 1.6 2016/04/26 19:49:22 tb Exp $ 284cdeef4Smartynas.\" 384cdeef4Smartynas.\" Copyright (c) 2007 David Schultz <das@FreeBSD.org> 484cdeef4Smartynas.\" All rights reserved. 584cdeef4Smartynas.\" 684cdeef4Smartynas.\" Redistribution and use in source and binary forms, with or without 784cdeef4Smartynas.\" modification, are permitted provided that the following conditions 884cdeef4Smartynas.\" are met: 984cdeef4Smartynas.\" 1. Redistributions of source code must retain the above copyright 1084cdeef4Smartynas.\" notice, this list of conditions and the following disclaimer. 1184cdeef4Smartynas.\" 2. Redistributions in binary form must reproduce the above copyright 1284cdeef4Smartynas.\" notice, this list of conditions and the following disclaimer in the 1384cdeef4Smartynas.\" documentation and/or other materials provided with the distribution. 1484cdeef4Smartynas.\" 1584cdeef4Smartynas.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 1684cdeef4Smartynas.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 1784cdeef4Smartynas.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 1884cdeef4Smartynas.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 1984cdeef4Smartynas.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2084cdeef4Smartynas.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2184cdeef4Smartynas.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2284cdeef4Smartynas.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2384cdeef4Smartynas.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2484cdeef4Smartynas.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 2584cdeef4Smartynas.\" SUCH DAMAGE. 2684cdeef4Smartynas.\" 2784cdeef4Smartynas.\" $FreeBSD: src/lib/msun/man/nan.3,v 1.1 2007/12/16 21:19:28 das Exp $ 2884cdeef4Smartynas.\" 29*9f1be2b6Stb.Dd $Mdocdate: April 26 2016 $ 3084cdeef4Smartynas.Dt NAN 3 3184cdeef4Smartynas.Os 3284cdeef4Smartynas.Sh NAME 3384cdeef4Smartynas.Nm nan , 34854ac34eSmartynas.Nm nanf , 35854ac34eSmartynas.Nm nanl 36*9f1be2b6Stb.Nd quiet NaNs 3784cdeef4Smartynas.Sh SYNOPSIS 3884cdeef4Smartynas.In math.h 3984cdeef4Smartynas.Ft double 4084cdeef4Smartynas.Fn nan "const char *s" 4184cdeef4Smartynas.Ft float 4284cdeef4Smartynas.Fn nanf "const char *s" 43854ac34eSmartynas.Ft long double 44854ac34eSmartynas.Fn nanl "const char *s" 4584cdeef4Smartynas.Sh DESCRIPTION 4684cdeef4SmartynasThe 4784cdeef4Smartynas.Dv NAN 48*9f1be2b6Stbmacro expands to a quiet NaN (Not A Number). 49d309d4cfSjmcSimilarly both the 50854ac34eSmartynas.Fn nan , 5184cdeef4Smartynas.Fn nanf 52854ac34eSmartynasand 53854ac34eSmartynas.Fn nanl 54*9f1be2b6Stbfunctions generate a quiet NaN value without raising an invalid exception. 5584cdeef4SmartynasThe argument 5684cdeef4Smartynas.Fa s 5784cdeef4Smartynasshould point to either an empty string or a hexadecimal representation 58d309d4cfSjmcof a non-negative integer (e.g. 0x1234). 5984cdeef4SmartynasIn the latter case, the integer is encoded in some free bits in the 60*9f1be2b6Stbrepresentation of the NaN, which sometimes stores 61*9f1be2b6Stbmachine-specific information about why a particular NaN was generated. 6284cdeef4SmartynasThere are 22 such bits available for 6384cdeef4Smartynas.Vt float 6484cdeef4Smartynasvariables, 51 bits for 6584cdeef4Smartynas.Vt double 6684cdeef4Smartynasvariables, and at least 51 bits for a 6784cdeef4Smartynas.Vt long double . 6884cdeef4SmartynasIf 6984cdeef4Smartynas.Fa s 7084cdeef4Smartynasis improperly formatted or represents an integer that is too large, 71*9f1be2b6Stbthen the particular encoding of the quiet NaN that is returned 7284cdeef4Smartynasis indeterminate. 7384cdeef4Smartynas.Sh COMPATIBILITY 7484cdeef4SmartynasCalling these functions with a non-empty string isn't portable. 7584cdeef4SmartynasAnother operating system may translate the string into a different 76*9f1be2b6StbNaN encoding, and furthermore, the meaning of a given NaN encoding 7784cdeef4Smartynasvaries across machine architectures. 7884cdeef4SmartynasIf you understood the innards of a particular platform well enough to 7984cdeef4Smartynasknow what string to use, then you would have no need for these functions 8084cdeef4Smartynasanyway, so don't use them. 8184cdeef4SmartynasUse the 8284cdeef4Smartynas.Dv NAN 8384cdeef4Smartynasmacro instead. 8484cdeef4Smartynas.Sh SEE ALSO 8584cdeef4Smartynas.Xr isnan 3 , 8684cdeef4Smartynas.Xr strtod 3 8784cdeef4Smartynas.Sh STANDARDS 8884cdeef4SmartynasThe 89854ac34eSmartynas.Fn nan , 9084cdeef4Smartynas.Fn nanf 91854ac34eSmartynasand 92854ac34eSmartynas.Fn nanl 9384cdeef4Smartynasfunctions and the 9484cdeef4Smartynas.Dv NAN 9584cdeef4Smartynasmacro conform to 9684cdeef4Smartynas.St -isoC-99 . 97