1float.h(3HEAD) Headers float.h(3HEAD)
2
3
4
6 float.h, float - floating types
7
9 #include <float.h>
10
11
13 The characteristics of floating types are defined in terms of a model
14 that describes a representation of floating-point numbers and values
15 that provide information about an implementation's floating-point
16 arithmetic.
17
18
19 The following parameters are used to define the model for each float‐
20 ing-point type:
21
22 s sign (±1)
23
24
25 b base or radix of exponent representation (an integer >1)
26
27
28 e exponent (an integer between a minimum e(min) and a maximum
29 e(max))
30
31
32 p precision (the number of base-b digits in the significand)
33
34
35 f(k) non-negative integers less than b (the significand digits)
36
37
38
39 In addition to normalized floating-point numbers (f(1)>0 if x≠0),
40 floating types might be able to contain other kinds of floating-point
41 numbers, such as subnormal floating-point numbers (x≠0, e=e(min),
42 f(1)=0) and unnormalized floating-point numbers (x≠0, e=e(min),
43 f(1)=0), and values that are not floating-point numbers, such as
44 infinities and NaNs. A NaN is an encoding signifying Not-a-Number. A
45 quiet NaN propagates through almost every arithmetic operation without
46 raising a floating-point exception; a signaling NaN generally raises a
47 floating-point exception when occurring as an arithmetic operand.
48
49
50 The accuracy of the library functions in math.h(3HEAD) and com‐
51 plex.h(3HEAD) that return floating-point results is defined on the
52 libm(3LIB) manual page.
53
54
55 All integer values in the <float.h> header, except FLT_ROUNDS, are con‐
56 stant expressions suitable for use in #if preprocessing directives; all
57 floating values are constant expressions. All except DECIMAL_DIG,
58 FLT_EVAL_METHOD, FLT_RADIX, and FLT_ROUNDS have separate names for all
59 three floating-point types. The floating-point model representation is
60 provided for all values except FLT_EVAL_METHOD and FLT_ROUNDS.
61
62
63 The rounding mode for floating-point addition is characterized by the
64 value of FLT_ROUNDS:
65
66 -1 Indeterminable.
67
68
69 0 Toward zero.
70
71
72 1 To nearest.
73
74
75 2 Toward positive infinity.
76
77
78 3 Toward negative infinity.
79
80
81
82 The values of operations with floating operands and values subject to
83 the usual arithmetic conversions and of floating constants are evalu‐
84 ated to a format whose range and precision might be greater than
85 required by the type. The use of evaluation formats is characterized by
86 the architecture-dependent value of FLT_EVAL_METHOD:
87
88 -1 Indeterminable.
89
90
91 0 Evaluate all operations and constants just to the range and pre‐
92 cision of the type.
93
94
95 1 Evaluate operations and constants of type float and double to the
96 range and precision of the double type; evaluate long double
97 operations and constants to the range and precision of the long
98 double type.
99
100
101 2 Evaluate all operations and constants to the range and precision
102 of the long double type.
103
104
105
106 The values given in the following list are defined as constants.
107
108 o Radix of exponent representation, b.
109
110 FLT_RADIX
111
112
113 o Number of base-FLT_RADIX digits in the floating-point sig‐
114 nificand, p.
115
116 FLT_MANT_DIG
117 DBL_MANT_DIG
118 LDBL_MANT_DIG
119
120
121 o Number of decimal digits, n, such that any floating-point
122 number in the widest supported floating type with p(max)
123 radix b digits can be rounded to a floating-point number
124 with n decimal digits and back again without change to the
125 value.
126
127 DECIMAL_DIG
128
129
130 o Number of decimal digits, q, such that any floating-point
131 number with q decimal digits can be rounded into a floating-
132 point number with p radix b digits and back again without
133 change to the q decimal digits.
134
135 FLT_DIG
136 DBL_DIG
137 LDBL_DIG
138
139
140 o Minimum negative integer such that FLT_RADIX raised to that
141 power minus 1 is a normalized floating-point number, e(min).
142
143 FLT_MIN_EXP
144 DBL_MIN_EXP
145 LDBL_MIN_EXP
146
147
148 o Minimum negative integer such that 10 raised to that power
149 is in the range of normalized floating-point numbers.
150
151 FLT_MIN_10_EXP
152 DBL_MIN_10_EXP
153 LDBL_MIN_10_EXP
154
155
156 o Maximum integer such that FLT_RADIX raised to that power
157 minus 1 is a representable finite floating-point number,
158 e(max).
159
160 FLT_MAX_EXP
161 DBL_MAX_EXP
162 LDBL_MAX_EXP
163
164
165 o Maximum integer such that 10 raised to that power is in the
166 range of representable finite floating-point numbers.
167
168 FLT_MAX_10_EXP
169 DBL_MAX_10_EXP
170 LDBL_MAX_10_EXP
171
172
173
174 The values given in the following list are defined as constant expres‐
175 sions with values that are greater than or equal to those shown:
176
177 o Maximum representable finite floating-point number.
178
179 FLT_MAX
180 DBL_MAX
181 LDBL_MAX
182
183
184
185 The values given in the following list are defined as constant expres‐
186 sions with implementation-defined (positive) values that are less than
187 or equal to those shown:
188
189 o The difference between 1 and the least value greater than 1
190 that is representable in the given floating-point type, b^1
191 - p.
192
193 FLT_EPSILON
194 DBL_EPSILON
195 LDBL_EPSILON
196
197
198 o Minimum normalized positive floating-point number,
199 b^e(min)^-1.
200
201 FLT_MIN
202 DBL_MIN
203 LDBL_MIN
204
205
207 See attributes(5) for descriptions of the following attributes:
208
209
210
211
212 ┌─────────────────────────────┬─────────────────────────────┐
213 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
214 ├─────────────────────────────┼─────────────────────────────┤
215 │Interface Stability │Standard │
216 └─────────────────────────────┴─────────────────────────────┘
217
219 complex.h(3HEAD), math.h(3HEAD), attributes(5), standards(5)
220
221
222
223SunOS 5.11 17 Dec 2003 float.h(3HEAD)