Files
oldlinux-files/study/Ref-docs/C/float.html
2024-02-19 00:25:23 -05:00

381 lines
13 KiB
HTML

<HTML><HEAD><TITLE>&lt;float.h&gt;</TITLE></HEAD><BODY BGCOLOR="#FFFFFF">
<H1><A NAME="&lt;float.h&gt;"><CODE>&lt;float.h&gt;</CODE></A></H1><HR>
<P><CODE>
#define <A HREF="#DBL_DIG"><B>DBL_DIG</B></A>
<I>&lt;integer rvalue &gt;= 10&gt;</I><BR>
#define <A HREF="#DBL_EPSILON"><B>DBL_EPSILON</B></A>
<I>&lt;double rvalue &lt;= 10^(-9)&gt;</I><BR>
#define <A HREF="#DBL_MANT_DIG"><B>DBL_MANT_DIG</B></A>
<I>&lt;integer rvalue&gt;</I><BR>
#define <A HREF="#DBL_MAX"><B>DBL_MAX</B></A>
<I>&lt;double rvalue &gt;= 10^37&gt;</I><BR>
#define <A HREF="#DBL_MAX_10_EXP"><B>DBL_MAX_10_EXP</B></A>
<I>&lt;integer rvalue &gt;= 37&gt;</I><BR>
#define <A HREF="#DBL_MAX_EXP"><B>DBL_MAX_EXP</B></A>
<I>&lt;integer rvalue&gt;</I><BR>
#define <A HREF="#DBL_MIN"><B>DBL_MIN</B></A>
<I>&lt;double rvalue &lt;= 10^(-37)&gt;</I><BR>
#define <A HREF="#DBL_MIN_10_EXP"><B>DBL_MIN_10_EXP</B></A>
<I>&lt;integer rvalue &lt;= -37&gt;</I><BR>
#define <A HREF="#DBL_MIN_EXP"><B>DBL_MIN_EXP</B></A>
<I>&lt;integer rvalue&gt;</I><BR>
#define <A HREF="#FLT_DIG"><B>FLT_DIG</B></A>
<I>&lt;integer rvalue &gt;= 6&gt;</I><BR>
#define <A HREF="#FLT_EPSILON"><B>FLT_EPSILON</B></A>
<I>&lt;float rvalue &lt;= 10^(-5)&gt;</I><BR>
#define <A HREF="#FLT_MANT_DIG"><B>FLT_MANT_DIG</B></A>
<I>&lt;integer rvalue&gt;</I><BR>
#define <A HREF="#FLT_MAX"><B>FLT_MAX</B></A>
<I>&lt;float rvalue &gt;= 10^37&gt;</I><BR>
#define <A HREF="#FLT_MAX_10_EXP"><B>FLT_MAX_10_EXP</B></A>
<I>&lt;integer rvalue &gt;= 37&gt;</I><BR>
#define <A HREF="#FLT_MAX_EXP"><B>FLT_MAX_EXP</B></A>
<I>&lt;integer rvalue&gt;</I><BR>
#define <A HREF="#FLT_MIN"><B>FLT_MIN</B></A>
<I>&lt;float rvalue &lt;= 10^(-37)&gt;</I><BR>
#define <A HREF="#FLT_MIN_10_EXP"><B>FLT_MIN_10_EXP</B></A>
<I>&lt;integer rvalue &lt;= -37&gt;</I><BR>
#define <A HREF="#FLT_MIN_EXP"><B>FLT_MIN_EXP</B></A>
<I>&lt;integer rvalue&gt;</I><BR>
#define <A HREF="#FLT_RADIX"><B>FLT_RADIX</B></A>
<I>&lt;#if expression &gt;= 2&gt;</I><BR>
#define <A HREF="#FLT_ROUNDS"><B>FLT_ROUNDS</B></A>
<I>&lt;integer rvalue&gt;</I><BR>
#define <A HREF="#LDBL_DIG"><B>LDBL_DIG</B></A>
<I>&lt;integer rvalue &gt;= 10&gt;</I><BR>
#define <A HREF="#LDBL_EPSILON"><B>LDBL_EPSILON</B></A>
<I>&lt;long double rvalue &lt;= 10^(-9)&gt;</I><BR>
#define <A HREF="#LDBL_MANT_DIG"><B>LDBL_MANT_DIG</B></A>
<I>&lt;integer rvalue&gt;</I><BR>
#define <A HREF="#LDBL_MAX"><B>LDBL_MAX</B></A>
<I>&lt;long double rvalue &gt;= 10^37&gt;</I><BR>
#define <A HREF="#LDBL_MAX_10_EXP"><B>LDBL_MAX_10_EXP</B></A>
<I>&lt;integer rvalue &gt;= 37&gt;</I><BR>
#define <A HREF="#LDBL_MAX_EXP"><B>LDBL_MAX_EXP</B></A>
<I>&lt;integer rvalue&gt;</I><BR>
#define <A HREF="#LDBL_MIN"><B>LDBL_MIN</B></A>
<I>&lt;long double rvalue &lt;= 10^(-37)&gt;</I><BR>
#define <A HREF="#LDBL_MIN_10_EXP"><B>LDBL_MIN_10_EXP</B></A>
<I>&lt;integer rvalue &lt;= -37&gt;</I><BR>
#define <A HREF="#LDBL_MIN_EXP"><B>LDBL_MIN_EXP</B></A>
<I>&lt;integer rvalue&gt;</I>
</CODE></P>
<P>Include the standard header <B><CODE>&lt;float.h&gt;</CODE></B>
to determine various properties of floating-point type representations.
The standard header <CODE>&lt;float.h&gt;</CODE> is available even in a
<A HREF="lib_over.html#freestanding implementation" tppabs="http://ccs.ucsd.edu/c/lib_over.html#freestanding implementation">
freestanding implementation</A>.</P>
<P>You can test only the value of the macro
<A HREF="#FLT_RADIX"><CODE>FLT_RADIX</CODE></A> in an
<A HREF="preproc.html#if directive" tppabs="http://ccs.ucsd.edu/c/preproc.html#if directive"><I>if</I> directive</A>.
(The macro expands to a
<A HREF="preproc.html#if expression" tppabs="http://ccs.ucsd.edu/c/preproc.html#if expression"><I><I>#if</I> expression</A>.)
All other macros defined in this header expand to expressions whose
values can be determined only when the program executes. (These macros are
<A HREF="express.html#rvalue expression" tppabs="http://ccs.ucsd.edu/c/express.html#rvalue expression">rvalue expressions</A>.)
Some target environments can change
the rounding and error-reporting properties of floating-point type
representations while the program is running.</P>
<H2><A NAME="DBL_DIG"><CODE>DBL_DIG</CODE></A></H2>
<P><CODE>
#define <B>DBL_DIG</B> <I>&lt;integer rvalue &gt;= 10&gt;</I>
</CODE></P>
<P>The macro yields the precision in decimal digits for
type <I>double.</I></P>
<H2><A NAME="DBL_EPSILON"><CODE>DBL_EPSILON</CODE></A></H2>
<P><CODE>
#define <B>DBL_EPSILON</B> <I>&lt;double rvalue &lt;= 10^(-9)&gt;</I>
</CODE></P>
<P>The macro yields the smallest <I>X</I> of type <I>double</I>
such that 1.0 + <I>X</I> != 1.0.</P>
<H2><A NAME="DBL_MANT_DIG"><CODE>DBL_MANT_DIG</CODE></A></H2>
<P><CODE>
#define <B>DBL_MANT_DIG</B> <I>&lt;integer rvalue&gt;</I>
</CODE></P>
<P>The macro yields the number of mantissa digits, base
<A HREF="#FLT_RADIX"><CODE>FLT_RADIX</CODE></A>,
for type <I>double.</I></P>
<H2><A NAME="DBL_MAX"><CODE>DBL_MAX</CODE></A></H2>
<P><CODE>
#define <B>DBL_MAX</B> <I>&lt;double rvalue &gt;= 10^37&gt;</I>
</CODE></P>
<P>The macro yields the largest finite representable value
of type <I>double.</I></P>
<H2><A NAME="DBL_MAX_10_EXP"><CODE>DBL_MAX_10_EXP</CODE></A></H2>
<P><CODE>
#define <B>DBL_MAX_10_EXP</B> <I>&lt;integer rvalue &gt;= 37&gt;</I>
</CODE></P>
<P>The macro yields the maximum integer <I>X,</I> such that
10^<I>X</I> is a finite representable value of type <I>double.</I></P>
<H2><A NAME="DBL_MAX_EXP"><CODE>DBL_MAX_EXP</CODE></A></H2>
<P><CODE>
#define <B>DBL_MAX_EXP</B> <I>&lt;integer rvalue&gt;</I>
</CODE></P>
<P>The macro yields the maximum integer <I>X,</I> such that
<A HREF="#FLT_RADIX"><CODE>FLT_RADIX</CODE></A>^(<I>X</I> - 1)
is a finite representable value of type <I>double.</I></P>
<H2><A NAME="DBL_MIN"><CODE>DBL_MIN</CODE></A></H2>
<P><CODE>
#define <B>DBL_MIN</B> <I>&lt;double rvalue &lt;= 10^(-37)&gt;</I>
</CODE></P>
<P>The macro yields the smallest normalized, finite representable
value of type <I>double.</I></P>
<H2><A NAME="DBL_MIN_10_EXP"><CODE>DBL_MIN_10_EXP</CODE></A></H2>
<P><CODE>
#define <B>DBL_MIN_10_EXP</B> <I>&lt;integer rvalue &lt;= -37&gt;</I>
</CODE></P>
<P>The macro yields the minimum integer <I>X</I> such that
10^<I>X</I> is a normalized, finite representable value
of type <I>double.</I></P>
<H2><A NAME="DBL_MIN_EXP"><CODE>DBL_MIN_EXP</CODE></A></H2>
<P><CODE>
#define <B>DBL_MIN_EXP</B> <I>&lt;integer rvalue&gt;</I>
</CODE></P>
<P>The macro yields the minimum integer <I>X</I> such that
<A HREF="#FLT_RADIX"><CODE>FLT_RADIX</CODE></A>^(<I>X</I> - 1)
is a normalized, finite representable value of type <I>double.</I></P>
<H2><A NAME="FLT_DIG"><CODE>FLT_DIG</CODE></A></H2>
<P><CODE>
#define <B>FLT_DIG</B> <I>&lt;integer rvalue &gt;= 6&gt;</I>
</CODE></P>
<P>The macro yields the precision in decimal digits
for type <I>float.</I></P>
<H2><A NAME="FLT_EPSILON"><CODE>FLT_EPSILON</CODE></A></H2>
<P><CODE>
#define <B>FLT_EPSILON</B> <I>&lt;float rvalue &lt;= 10^(-5)&gt;</I>
</CODE></P>
<P>The macro yields the smallest <I>X</I> of type <I>float</I>
such that 1.0 + <I>X</I> != 1.0.</P>
<H2><A NAME="FLT_MANT_DIG"><CODE>FLT_MANT_DIG</CODE></A></H2>
<P><CODE>
#define <B>FLT_MANT_DIG</B> <I>&lt;integer rvalue&gt;</I>
</CODE></P>
<P>The macro yields the number of mantissa digits, base
<A HREF="#FLT_RADIX"><CODE>FLT_RADIX</CODE></A>,
for type <I>float.</I></P>
<H2><A NAME="FLT_MAX"><CODE>FLT_MAX</CODE></A></H2>
<P><CODE>
#define <B>FLT_MAX</B> <I>&lt;float rvalue &gt;= 10^37&gt;</I>
</CODE></P>
<P>The macro yields the largest finite representable value
of type <I>float.</I></P>
<H2><A NAME="FLT_MAX_10_EXP"><CODE>FLT_MAX_10_EXP</CODE></A></H2>
<P><CODE>
#define <B>FLT_MAX_10_EXP</B> <I>&lt;integer rvalue &gt;= 37&gt;</I>
</CODE></P>
<P>The macro yields the maximum integer <I>X,</I> such that 10^<I>X</I>
is a finite representable value of type <I>float.</I></P>
<H2><A NAME="FLT_MAX_EXP"><CODE>FLT_MAX_EXP</CODE></A></H2>
<P><CODE>
#define <B>FLT_MAX_EXP</B> <I>&lt;integer rvalue&gt;</I>
</CODE></P>
<P>The macro yields the maximum integer <I>X,</I> such that
<A HREF="#FLT_RADIX"><CODE>FLT_RADIX</CODE></A>^(<I>X</I> - 1)
is a finite representable value of type <I>float.</I></P>
<H2><A NAME="FLT_MIN"><CODE>FLT_MIN</CODE></A></H2>
<P><CODE>
#define <B>FLT_MIN</B> <I>&lt;float rvalue &lt;= 10^(-37)&gt;</I>
</CODE></P>
<P>The macro yields the smallest normalized, finite representable
value of type <I>float.</I></P>
<H2><A NAME="FLT_MIN_10_EXP"><CODE>FLT_MIN_10_EXP</CODE></A></H2>
<P><CODE>
#define <B>FLT_MIN_10_EXP</B> <I>&lt;integer rvalue &lt;= -37&gt;</I>
</CODE></P>
<P>The macro yields the minimum integer <I>X,</I> such that 10^<I>X</I>
is a normalized, finite representable value of type <I>float.</I></P>
<H2><A NAME="FLT_MIN_EXP"><CODE>FLT_MIN_EXP</CODE></A></H2>
<P><CODE>
#define <B>FLT_MIN_EXP</B> <I>&lt;integer rvalue&gt;</I>
</CODE></P>
<P>The macro yields the minimum integer <I>X,</I> such that
<A HREF="#FLT_RADIX"><CODE>FLT_RADIX</CODE></A>^(<I>X</I> - 1)
is a normalized, finite representable value of type <I>float.</I></P>
<H2><A NAME="FLT_RADIX"><CODE>FLT_RADIX</CODE></A></H2>
<P><CODE>
#define <B>FLT_RADIX</B> <I>&lt;#if expression &gt;= 2&gt;</I>
</CODE></P>
<P>The macro yields the radix of all floating-point representations.</P>
<H2><A NAME="FLT_ROUNDS"><CODE>FLT_ROUNDS</CODE></A></H2>
<P><CODE>
#define <B>FLT_ROUNDS</B> <I>&lt;integer rvalue&gt;</I>
</CODE></P>
<P>The macro yields a value that describes the current rounding
mode for floating-point operations. Note that the target environment
can change the rounding mode while the program executes. How it does
so, however, is not specified. The values are:</P>
<UL>
<LI>-1 if the mode is indeterminate
<LI>0 if rounding is toward zero
<LI>1 if rounding is to nearest representable value
<LI>2 if rounding is toward +infinity
<LI>3 if rounding is toward -infinity
</UL>
<P>An implementation can define additional values for this macro.</P>
<H2><A NAME="LDBL_DIG"><CODE>LDBL_DIG</CODE></A></H2>
<P><CODE>
#define <B>LDBL_DIG</B> <I>&lt;integer rvalue &gt;= 10&gt;</I>
</CODE></P>
<P>The macro yields the precision in decimal digits for type <I>long
double.</I></P>
<H2><A NAME="LDBL_EPSILON"><CODE>LDBL_EPSILON</CODE></A></H2>
<P><CODE>
#define <B>LDBL_EPSILON</B> <I>&lt;long double rvalue &lt;= 10^(-9)&gt;</I>
</CODE></P>
<P>The macro yields the smallest <I>X</I> of type <I>long double</I>
such that 1.0 + <I>X</I> != 1.0.</P>
<H2><A NAME="LDBL_MANT_DIG"><CODE>LDBL_MANT_DIG</CODE></A></H2>
<P><CODE>
#define <B>LDBL_MANT_DIG</B> <I>&lt;integer rvalue&gt;</I>
</CODE></P>
<P>The macro yields the number of mantissa digits, base
<A HREF="#FLT_RADIX"><CODE>FLT_RADIX</CODE></A>,
for type <I>long double.</I></P>
<H2><A NAME="LDBL_MAX"><CODE>LDBL_MAX</CODE></A></H2>
<P><CODE>
#define <B>LDBL_MAX</B> <I>&lt;long double rvalue &gt;= 10^37&gt;</I>
</CODE></P>
<P>The macro yields the largest finite representable value of type
<I>long double.</I></P>
<H2><A NAME="LDBL_MAX_10_EXP"><CODE>LDBL_MAX_10_EXP</CODE></A></H2>
<P><CODE>
#define <B>LDBL_MAX_10_EXP</B> <I>&lt;integer rvalue &gt;= 37&gt;</I>
</CODE></P>
<P>The macro yields the maximum integer <I>X,</I> such that
10^<I>X</I> is a finite representable value of type <I>long double.</I></P>
<H2><A NAME="LDBL_MAX_EXP"><CODE>LDBL_MAX_EXP</CODE></A></H2>
<P><CODE>
#define <B>LDBL_MAX_EXP</B> <I>&lt;integer rvalue&gt;</I>
</CODE></P>
<P>The macro yields the maximum integer <I>X,</I> such that
<A HREF="#FLT_RADIX"><CODE>FLT_RADIX</CODE></A>^(<I>X</I> - 1)
is a finite representable value of type <I>long double.</I></P>
<H2><A NAME="LDBL_MIN"><CODE>LDBL_MIN</CODE></A></H2>
<P><CODE>
#define <B>LDBL_MIN</B> <I>&lt;long double rvalue &lt;= 10^(-37)&gt;</I>
</CODE></P>
<P>The macro yields the smallest normalized, finite representable
value of type <I>long double.</I></P>
<H2><A NAME="LDBL_MIN_10_EXP"><CODE>LDBL_MIN_10_EXP</CODE></A></H2>
<P><CODE>
#define <B>LDBL_MIN_10_EXP</B> <I>&lt;integer rvalue &lt;= -37&gt;</I>
</CODE></P>
<P>The macro yields the minimum integer <I>X,</I> such that
10^<I>X</I> is a normalized, finite representable value
of type <I>long double.</I></P>
<H2><A NAME="LDBL_MIN_EXP"><CODE>LDBL_MIN_EXP</CODE></A></H2>
<P><CODE>
#define <B>LDBL_MIN_EXP</B> <I>&lt;integer rvalue&gt;</I>
</CODE></P>
<P>The macro yields the minimum integer <I>X,</I> such that
<A HREF="#FLT_RADIX"><CODE>FLT_RADIX</CODE></A>^(<I>X</I> - 1)
is a normalized, finite representable value of type <I>long double.</I></P>
<HR>
<P>See also the
<B><A HREF="index.html#Table of Contents" tppabs="http://ccs.ucsd.edu/c/index.html#Table of Contents">Table of Contents</A></B> and the
<B><A HREF="_index.html" tppabs="http://ccs.ucsd.edu/c/_index.html">Index</A></B>.</P>
<P><I>
<A HREF="crit_pb.html" tppabs="http://ccs.ucsd.edu/c/crit_pb.html">Copyright</A> &#169; 1989-1996
by P.J. Plauger and Jim Brodie. All rights reserved.</I></P>
</BODY></HTML>