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