add directory Ref-docs
This commit is contained in:
390
Ref-docs/POSIX/susv3/basedefs/float.h.html
Normal file
390
Ref-docs/POSIX/susv3/basedefs/float.h.html
Normal file
@@ -0,0 +1,390 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<html>
|
||||
<head>
|
||||
<meta name="generator" content="HTML Tidy, see www.w3.org">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
<link type="text/css" rel="stylesheet" href="style.css"><!-- Generated by The Open Group's rhtm tool v1.2.1 -->
|
||||
<!-- Copyright (c) 2001 The Open Group, All Rights Reserved -->
|
||||
<title><float.h></title>
|
||||
</head>
|
||||
<body bgcolor="white">
|
||||
<script type="text/javascript" language="JavaScript" src="../jscript/codes.js">
|
||||
</script>
|
||||
|
||||
<basefont size="3"> <a name="<float.h>"></a> <a name="tag_13_13"></a><!-- <float.h> -->
|
||||
<!--header start-->
|
||||
<center><font size="2">The Open Group Base Specifications Issue 6<br>
|
||||
IEEE Std 1003.1-2001<br>
|
||||
Copyright © 2001 The IEEE and The Open Group, All Rights reserved.</font></center>
|
||||
|
||||
<!--header end-->
|
||||
<hr size="2" noshade>
|
||||
<h4><a name="tag_13_13_01"></a>NAME</h4>
|
||||
|
||||
<blockquote>float.h - floating types</blockquote>
|
||||
|
||||
<h4><a name="tag_13_13_02"></a>SYNOPSIS</h4>
|
||||
|
||||
<blockquote class="synopsis">
|
||||
<p><tt>#include <float.h></tt></p>
|
||||
</blockquote>
|
||||
|
||||
<h4><a name="tag_13_13_03"></a>DESCRIPTION</h4>
|
||||
|
||||
<blockquote>
|
||||
<div class="box"><sup>[<a href="javascript:open_code('CX')">CX</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]"
|
||||
border="0"> The functionality described on this reference page is aligned with the ISO C standard. Any conflict between the
|
||||
requirements described here and the ISO C standard is unintentional. This volume of IEEE Std 1003.1-2001 defers to
|
||||
the ISO C standard. <img src="../images/opt-end.gif" alt="[Option End]" border="0"></div>
|
||||
|
||||
<p>The characteristics of floating types are defined in terms of a model that describes a representation of floating-point numbers
|
||||
and values that provide information about an implementation's floating-point arithmetic.</p>
|
||||
|
||||
<p>The following parameters are used to define the model for each floating-point type:</p>
|
||||
|
||||
<dl compact>
|
||||
<dt><i>s</i></dt>
|
||||
|
||||
<dd>Sign (±1).</dd>
|
||||
|
||||
<dt><i>b</i></dt>
|
||||
|
||||
<dd>Base or radix of exponent representation (an integer >1).</dd>
|
||||
|
||||
<dt><i>e</i></dt>
|
||||
|
||||
<dd>Exponent (an integer between a minimum <i>e</i><small><sub>min</sub></small> and a maximum <i>e</i><small><sub>max</sub></small>).</dd>
|
||||
|
||||
<dt><i>p</i></dt>
|
||||
|
||||
<dd>Precision (the number of base-<i>b</i> digits in the significand).</dd>
|
||||
|
||||
<dt><i>f</i><small><sub>k</sub></small></dt>
|
||||
|
||||
<dd>Non-negative integers less than <i>b</i> (the significand digits).</dd>
|
||||
</dl>
|
||||
|
||||
<p>A floating-point number <i>x</i> is defined by the following model:</p>
|
||||
|
||||
<p><img src="../images/floath-1.gif">
|
||||
</p>
|
||||
<p>In addition to normalized floating-point numbers (<i>f</i><small><sub>1</sub></small>>0 if <i>x</i>!=0), floating types may be able to contain other
|
||||
kinds of floating-point numbers, such as subnormal floating-point numbers ( <i>x</i>!=0, <i>e</i>= <i>e</i><small><sub>min</sub></small>, <i>f</i><small><sub>1</sub></small>=0) and
|
||||
unnormalized floating-point numbers ( <i>x</i>!=0, <i>e</i>> <i>e</i><small><sub>min</sub></small>, <i>f</i><small><sub>1</sub></small>=0), and values that are not floating-point
|
||||
numbers, such as infinities and NaNs. A <i>NaN</i> is an encoding signifying Not-a-Number. A <i>quiet NaN</i> propagates through
|
||||
almost every arithmetic operation without raising a floating-point exception; a <i>signaling NaN</i> generally raises a
|
||||
floating-point exception when occurring as an arithmetic operand.</p>
|
||||
|
||||
<p>The accuracy of the floating-point operations ( <tt>'+'</tt> , <tt>'-'</tt> , <tt>'*'</tt> , <tt>'/'</tt> ) and of the library
|
||||
functions in <a href="../basedefs/math.h.html"><i><math.h></i></a> and <a href=
|
||||
"../basedefs/complex.h.html"><i><complex.h></i></a> that return floating-point results is implementation-defined. The
|
||||
implementation may state that the accuracy is unknown.</p>
|
||||
|
||||
<p>All integer values in the <i><float.h></i> header, except FLT_ROUNDS, shall be constant expressions suitable for use in
|
||||
<b>#if</b> preprocessing directives; all floating values shall be constant expressions. All except DECIMAL_DIG, FLT_EVAL_METHOD,
|
||||
FLT_RADIX, and FLT_ROUNDS have separate names for all three floating-point types. The floating-point model representation is
|
||||
provided for all values except FLT_EVAL_METHOD and FLT_ROUNDS.</p>
|
||||
|
||||
<p>The rounding mode for floating-point addition is characterized by the implementation-defined value of FLT_ROUNDS:</p>
|
||||
|
||||
<dl compact>
|
||||
<dt>-1</dt>
|
||||
|
||||
<dd>Indeterminable.</dd>
|
||||
|
||||
<dt> 0</dt>
|
||||
|
||||
<dd>Toward zero.</dd>
|
||||
|
||||
<dt> 1</dt>
|
||||
|
||||
<dd>To nearest.</dd>
|
||||
|
||||
<dt> 2</dt>
|
||||
|
||||
<dd>Toward positive infinity.</dd>
|
||||
|
||||
<dt> 3</dt>
|
||||
|
||||
<dd>Toward negative infinity.</dd>
|
||||
</dl>
|
||||
|
||||
<p>All other values for FLT_ROUNDS characterize implementation-defined rounding behavior.</p>
|
||||
|
||||
<p>The values of operations with floating operands and values subject to the usual arithmetic conversions and of floating constants
|
||||
are evaluated to a format whose range and precision may be greater than required by the type. The use of evaluation formats is
|
||||
characterized by the implementation-defined value of FLT_EVAL_METHOD:</p>
|
||||
|
||||
<dl compact>
|
||||
<dt>-1</dt>
|
||||
|
||||
<dd>Indeterminable.</dd>
|
||||
|
||||
<dt> 0</dt>
|
||||
|
||||
<dd>Evaluate all operations and constants just to the range and precision of the type.</dd>
|
||||
|
||||
<dt> 1</dt>
|
||||
|
||||
<dd>Evaluate operations and constants of type <b>float</b> and <b>double</b> to the range and precision of the <b>double</b> type;
|
||||
evaluate <b>long double</b> operations and constants to the range and precision of the <b>long double</b> type.</dd>
|
||||
|
||||
<dt> 2</dt>
|
||||
|
||||
<dd>Evaluate all operations and constants to the range and precision of the <b>long double</b> type.</dd>
|
||||
</dl>
|
||||
|
||||
<p>All other negative values for FLT_EVAL_METHOD characterize implementation-defined behavior.</p>
|
||||
|
||||
<p>The values given in the following list shall be defined as constant expressions with implementation-defined values that are
|
||||
greater or equal in magnitude (absolute value) to those shown, with the same sign.</p>
|
||||
|
||||
<ul>
|
||||
<li>
|
||||
<p>Radix of exponent representation, <i>b</i>.</p>
|
||||
|
||||
<dl compact>
|
||||
<dt>FLT_RADIX</dt>
|
||||
|
||||
<dd>2</dd>
|
||||
</dl>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<p>Number of base-FLT_RADIX digits in the floating-point significand, <i>p</i>.</p>
|
||||
|
||||
<dl compact>
|
||||
<dt>FLT_MANT_DIG</dt>
|
||||
|
||||
<dt>DBL_MANT_DIG</dt>
|
||||
|
||||
<dt>LDBL_MANT_DIG</dt>
|
||||
</dl>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<p>Number of decimal digits, <i>n</i>, such that any floating-point number in the widest supported floating type with <i>p</i><small><sub>max</sub></small>
|
||||
radix <i>b</i> digits can be rounded to a floating-point number with <i>n</i> decimal digits and back again without change to the
|
||||
value.</p>
|
||||
|
||||
<p><img src="../images/floath-2.gif">
|
||||
</p>
|
||||
<dl compact>
|
||||
<dt>DECIMAL_DIG</dt>
|
||||
|
||||
<dd>10</dd>
|
||||
</dl>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<p>Number of decimal digits, <i>q</i>, such that any floating-point number with <i>q</i> decimal digits can be rounded into a
|
||||
floating-point number with <i>p</i> radix <i>b</i> digits and back again without change to the <i>q</i> decimal digits.</p>
|
||||
|
||||
<p><img src="../images/floath-3.gif">
|
||||
</p>
|
||||
|
||||
<dl compact>
|
||||
<dt>FLT_DIG</dt>
|
||||
|
||||
<dd>6</dd>
|
||||
|
||||
<dt>DBL_DIG</dt>
|
||||
|
||||
<dd>10</dd>
|
||||
|
||||
<dt>LDBL_DIG</dt>
|
||||
|
||||
<dd>10</dd>
|
||||
</dl>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<p>Minimum negative integer such that FLT_RADIX raised to that power minus 1 is a normalized floating-point number, <i>e</i><small><sub>min</sub></small>.</p>
|
||||
|
||||
<dl compact>
|
||||
<dt>FLT_MIN_EXP</dt>
|
||||
|
||||
<dt>DBL_MIN_EXP</dt>
|
||||
|
||||
<dt>LDBL_MIN_EXP</dt>
|
||||
</dl>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<p>Minimum negative integer such that 10 raised to that power is in the range of normalized floating-point numbers.</p>
|
||||
|
||||
<p><img src="../images/floath-4.gif">
|
||||
</p>
|
||||
<dl compact>
|
||||
<dt>FLT_MIN_10_EXP</dt>
|
||||
|
||||
<dd>-37</dd>
|
||||
|
||||
<dt>DBL_MIN_10_EXP</dt>
|
||||
|
||||
<dd>-37</dd>
|
||||
|
||||
<dt>LDBL_MIN_10_EXP</dt>
|
||||
|
||||
<dd>-37</dd>
|
||||
</dl>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<p>Maximum integer such that FLT_RADIX raised to that power minus 1 is a representable finite floating-point number, <i>e</i><small><sub>max</sub></small>.</p>
|
||||
|
||||
<dl compact>
|
||||
<dt>FLT_MAX_EXP</dt>
|
||||
|
||||
<dt>DBL_MAX_EXP</dt>
|
||||
|
||||
<dt>LDBL_MAX_EXP</dt>
|
||||
</dl>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<p>Maximum integer such that 10 raised to that power is in the range of representable finite floating-point numbers.</p>
|
||||
|
||||
<p><img src="../images/floath-5.gif">
|
||||
</p>
|
||||
<dl compact>
|
||||
<dt>FLT_MAX_10_EXP</dt>
|
||||
|
||||
<dd>+37</dd>
|
||||
|
||||
<dt>DBL_MAX_10_EXP</dt>
|
||||
|
||||
<dd>+37</dd>
|
||||
|
||||
<dt>LDBL_MAX_10_EXP</dt>
|
||||
|
||||
<dd>+37</dd>
|
||||
</dl>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<p>The values given in the following list shall be defined as constant expressions with implementation-defined values that are
|
||||
greater than or equal to those shown:</p>
|
||||
|
||||
<ul>
|
||||
<li>
|
||||
<p>Maximum representable finite floating-point number.</p>
|
||||
|
||||
<p><img src="../images/floath-6.gif">
|
||||
</p>
|
||||
<dl compact>
|
||||
<dt>FLT_MAX</dt>
|
||||
|
||||
<dd>1E+37</dd>
|
||||
|
||||
<dt>DBL_MAX</dt>
|
||||
|
||||
<dd>1E+37</dd>
|
||||
|
||||
<dt>LDBL_MAX</dt>
|
||||
|
||||
<dd>1E+37</dd>
|
||||
</dl>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<p>The values given in the following list shall be defined as constant expressions with implementation-defined (positive) values
|
||||
that are less than or equal to those shown:</p>
|
||||
|
||||
<ul>
|
||||
<li>
|
||||
<p>The difference between 1 and the least value greater than 1 that is representable in the given floating-point type, <i>b</i><small><sup>1-<i>p</i></sup></small>.</p>
|
||||
|
||||
<dl compact>
|
||||
<dt>FLT_EPSILON</dt>
|
||||
|
||||
<dd>1E-5</dd>
|
||||
|
||||
<dt>DBL_EPSILON</dt>
|
||||
|
||||
<dd>1E-9</dd>
|
||||
|
||||
<dt>LDBL_EPSILON</dt>
|
||||
|
||||
<dd>1E-9</dd>
|
||||
</dl>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<p>Minimum normalized positive floating-point number, <i>b</i><small><sup><i>e</i><sub>min</sub><sup> -1</sup></sup></small>.</p>
|
||||
|
||||
<dl compact>
|
||||
<dt>FLT_MIN</dt>
|
||||
|
||||
<dd>1E-37</dd>
|
||||
|
||||
<dt>DBL_MIN</dt>
|
||||
|
||||
<dd>1E-37</dd>
|
||||
|
||||
<dt>LDBL_MIN</dt>
|
||||
|
||||
<dd>1E-37</dd>
|
||||
</dl>
|
||||
</li>
|
||||
</ul>
|
||||
</blockquote>
|
||||
|
||||
<hr>
|
||||
<div class="box"><em>The following sections are informative.</em></div>
|
||||
|
||||
<h4><a name="tag_13_13_04"></a>APPLICATION USAGE</h4>
|
||||
|
||||
<blockquote>
|
||||
<p>None.</p>
|
||||
</blockquote>
|
||||
|
||||
<h4><a name="tag_13_13_05"></a>RATIONALE</h4>
|
||||
|
||||
<blockquote>
|
||||
<p>None.</p>
|
||||
</blockquote>
|
||||
|
||||
<h4><a name="tag_13_13_06"></a>FUTURE DIRECTIONS</h4>
|
||||
|
||||
<blockquote>
|
||||
<p>None.</p>
|
||||
</blockquote>
|
||||
|
||||
<h4><a name="tag_13_13_07"></a>SEE ALSO</h4>
|
||||
|
||||
<blockquote>
|
||||
<p><a href="complex.h.html"><i><complex.h></i></a> , <a href="math.h.html"><i><math.h></i></a></p>
|
||||
</blockquote>
|
||||
|
||||
<h4><a name="tag_13_13_08"></a>CHANGE HISTORY</h4>
|
||||
|
||||
<blockquote>
|
||||
<p>First released in Issue 4. Derived from the ISO C standard.</p>
|
||||
</blockquote>
|
||||
|
||||
<h4><a name="tag_13_13_09"></a>Issue 6</h4>
|
||||
|
||||
<blockquote>
|
||||
<p>The description of the operations with floating-point values is updated for alignment with the ISO/IEC 9899:1999
|
||||
standard.<br>
|
||||
</p>
|
||||
|
||||
</blockquote>
|
||||
|
||||
<div class="box"><em>End of informative text.</em></div>
|
||||
|
||||
<hr>
|
||||
<hr size="2" noshade>
|
||||
<center><font size="2"><!--footer start-->
|
||||
UNIX ® is a registered Trademark of The Open Group.<br>
|
||||
POSIX ® is a registered Trademark of The IEEE.<br>
|
||||
[ <a href="../mindex.html">Main Index</a> | <a href="../basedefs/contents.html">XBD</a> | <a href=
|
||||
"../utilities/contents.html">XCU</a> | <a href="../functions/contents.html">XSH</a> | <a href="../xrat/contents.html">XRAT</a>
|
||||
]</font></center>
|
||||
|
||||
<!--footer end-->
|
||||
<hr size="2" noshade>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user