📄 float.html
字号:
<HTML><HEAD><TITLE><float.h></TITLE></HEAD><BODY><H1><A NAME="<float.h>"><CODE><float.h></CODE></A></H1><HR><P>Include the standard header <B><CODE><float.h></CODE></B>to determine various properties of floating-point type representations.The standard header <CODE><float.h></CODE> is available even in a<A HREF="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 <I>if</I> directive.All other macros defined in this header expand to expressions whosevalues can be determined only when the program executes. (These macros are<A HREF="express.html#rvalue expression">rvalue expressions</A>.)</P><P>Some target environments can changethe rounding and error-reporting properties of floating-point typerepresentations while the program is running.</P><PRE>#define <A HREF="#FLT_RADIX"><B>FLT_RADIX</B></A> <I><#if expression >= 2></I>#define <A HREF="#FLT_ROUNDS"><B>FLT_ROUNDS</B></A> <I><integer rvalue></I>#define <A HREF="#DBL_DIG"><B>DBL_DIG</B></A> <I><integer rvalue >= 10></I>#define <A HREF="#DBL_EPSILON"><B>DBL_EPSILON</B></A> <I><double rvalue <= 10^(-9)></I>#define <A HREF="#DBL_MANT_DIG"><B>DBL_MANT_DIG</B></A> <I><integer rvalue></I>#define <A HREF="#DBL_MAX"><B>DBL_MAX</B></A> <I><double rvalue >= 10^37></I>#define <A HREF="#DBL_MAX_10_EXP"><B>DBL_MAX_10_EXP</B></A> <I><integer rvalue >= 37></I>#define <A HREF="#DBL_MAX_EXP"><B>DBL_MAX_EXP</B></A> <I><integer rvalue></I>#define <A HREF="#DBL_MIN"><B>DBL_MIN</B></A> <I><double rvalue <= 10^(-37)></I>#define <A HREF="#DBL_MIN_10_EXP"><B>DBL_MIN_10_EXP</B></A> <I><integer rvalue <= -37></I>#define <A HREF="#DBL_MIN_EXP"><B>DBL_MIN_EXP</B></A> <I><integer rvalue></I>#define <A HREF="#FLT_DIG"><B>FLT_DIG</B></A> <I><integer rvalue >= 6></I>#define <A HREF="#FLT_EPSILON"><B>FLT_EPSILON</B></A> <I><float rvalue <= 10^(-5)></I>#define <A HREF="#FLT_MANT_DIG"><B>FLT_MANT_DIG</B></A> <I><integer rvalue></I>#define <A HREF="#FLT_MAX"><B>FLT_MAX</B></A> <I><float rvalue >= 10^37></I>#define <A HREF="#FLT_MAX_10_EXP"><B>FLT_MAX_10_EXP</B></A> <I><integer rvalue >= 37></I>#define <A HREF="#FLT_MAX_EXP"><B>FLT_MAX_EXP</B></A> <I><integer rvalue></I>#define <A HREF="#FLT_MIN"><B>FLT_MIN</B></A> <I><float rvalue <= 10^(-37)></I>#define <A HREF="#FLT_MIN_10_EXP"><B>FLT_MIN_10_EXP</B></A> <I><integer rvalue <= -37></I>#define <A HREF="#FLT_MIN_EXP"><B>FLT_MIN_EXP</B></A> <I><integer rvalue></I>#define <A HREF="#LDBL_DIG"><B>LDBL_DIG</B></A> <I><integer rvalue >= 10></I>#define <A HREF="#LDBL_EPSILON"><B>LDBL_EPSILON</B></A> <I><long double rvalue <= 10^(-9)></I>#define <A HREF="#LDBL_MANT_DIG"><B>LDBL_MANT_DIG</B></A> <I><integer rvalue></I>#define <A HREF="#LDBL_MAX"><B>LDBL_MAX</B></A> <I><long double rvalue >= 10^37></I>#define <A HREF="#LDBL_MAX_10_EXP"><B>LDBL_MAX_10_EXP</B></A> <I><integer rvalue >= 37></I>#define <A HREF="#LDBL_MAX_EXP"><B>LDBL_MAX_EXP</B></A> <I><integer rvalue></I>#define <A HREF="#LDBL_MIN"><B>LDBL_MIN</B></A> <I><long double rvalue <= 10^(-37)></I>#define <A HREF="#LDBL_MIN_10_EXP"><B>LDBL_MIN_10_EXP</B></A> <I><integer rvalue <= -37></I>#define <A HREF="#LDBL_MIN_EXP"><B>LDBL_MIN_EXP</B></A> <I><integer rvalue></I></PRE><H2><A NAME="DBL_DIG"><CODE>DBL_DIG</CODE></A></H2><PRE>#define <B>DBL_DIG</B> <I><integer rvalue >= 10></I></PRE><P>The macro yields the precision in decimal digits fortype <I>double.</I></P><H2><A NAME="DBL_EPSILON"><CODE>DBL_EPSILON</CODE></A></H2><PRE>#define <B>DBL_EPSILON</B> <I><double rvalue <= 10^(-9)></I></PRE><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><PRE>#define <B>DBL_MANT_DIG</B> <I><integer rvalue></I></PRE><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><PRE>#define <B>DBL_MAX</B> <I><double rvalue >= 10^37></I></PRE><P>The macro yields the largest finite representable valueof type <I>double.</I></P><H2><A NAME="DBL_MAX_10_EXP"><CODE>DBL_MAX_10_EXP</CODE></A></H2><PRE>#define <B>DBL_MAX_10_EXP</B> <I><integer rvalue >= 37></I></PRE><P>The macro yields the maximum integer <I>X,</I> such that10^<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><PRE>#define <B>DBL_MAX_EXP</B> <I><integer rvalue></I></PRE><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><PRE>#define <B>DBL_MIN</B> <I><double rvalue <= 10^(-37)></I></PRE><P>The macro yields the smallest normalized, finite representablevalue of type <I>double.</I></P><H2><A NAME="DBL_MIN_10_EXP"><CODE>DBL_MIN_10_EXP</CODE></A></H2><PRE>#define <B>DBL_MIN_10_EXP</B> <I><integer rvalue <= -37></I></PRE><P>The macro yields the minimum integer <I>X</I> such that10^<I>X</I> is a normalized, finite representable valueof type <I>double.</I></P><H2><A NAME="DBL_MIN_EXP"><CODE>DBL_MIN_EXP</CODE></A></H2><PRE>#define <B>DBL_MIN_EXP</B> <I><integer rvalue></I></PRE><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><PRE>#define <B>FLT_DIG</B> <I><integer rvalue >= 6></I></PRE><P>The macro yields the precision in decimal digitsfor type <I>float.</I></P><H2><A NAME="FLT_EPSILON"><CODE>FLT_EPSILON</CODE></A></H2><PRE>#define <B>FLT_EPSILON</B> <I><float rvalue <= 10^(-5)></I></PRE><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><PRE>#define <B>FLT_MANT_DIG</B> <I><integer rvalue></I></PRE><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><PRE>#define <B>FLT_MAX</B> <I><float rvalue >= 10^37></I></PRE><P>The macro yields the largest finite representable valueof type <I>float.</I></P><H2><A NAME="FLT_MAX_10_EXP"><CODE>FLT_MAX_10_EXP</CODE></A></H2><PRE>#define <B>FLT_MAX_10_EXP</B> <I><integer rvalue >= 37></I></PRE><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><PRE>#define <B>FLT_MAX_EXP</B> <I><integer rvalue></I></PRE><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><PRE>#define <B>FLT_MIN</B> <I><float rvalue <= 10^(-37)></I></PRE><P>The macro yields the smallest normalized, finite representablevalue of type <I>float.</I></P><H2><A NAME="FLT_MIN_10_EXP"><CODE>FLT_MIN_10_EXP</CODE></A></H2><PRE>#define <B>FLT_MIN_10_EXP</B> <I><integer rvalue <= -37></I></PRE><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><PRE>#define <B>FLT_MIN_EXP</B> <I><integer rvalue></I></PRE><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><PRE>#define <B>FLT_RADIX</B> <I><#if expression >= 2></I></PRE><P>The macro yields the radix of all floating-point representations.</P><H2><A NAME="FLT_ROUNDS"><CODE>FLT_ROUNDS</CODE></A></H2><PRE>#define <B>FLT_ROUNDS</B> <I><integer rvalue></I></PRE><P>The macro yields a value that describes the current roundingmode for floating-point operations. Note that the target environmentcan change the rounding mode while the program executes. How it doesso, however, is not specified. The values are:</P><UL><LI>-1 if the mode is indeterminate</LI><LI>0 if rounding is toward zero</LI><LI>1 if rounding is to nearest representable value</LI><LI>2 if rounding is toward positive infinity</LI><LI>3 if rounding is toward negative infinity</LI></UL><P>An implementation can define additional values for this macro.</P><H2><A NAME="LDBL_DIG"><CODE>LDBL_DIG</CODE></A></H2><PRE>#define <B>LDBL_DIG</B> <I><integer rvalue >= 10></I></PRE><P>The macro yields the precision in decimal digits for type <I>longdouble.</I></P><H2><A NAME="LDBL_EPSILON"><CODE>LDBL_EPSILON</CODE></A></H2><PRE>#define <B>LDBL_EPSILON</B> <I><long double rvalue <= 10^(-9)></I></PRE><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><PRE>#define <B>LDBL_MANT_DIG</B> <I><integer rvalue></I></PRE><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><PRE>#define <B>LDBL_MAX</B> <I><long double rvalue >= 10^37></I></PRE><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><PRE>#define <B>LDBL_MAX_10_EXP</B> <I><integer rvalue >= 37></I></PRE><P>The macro yields the maximum integer <I>X,</I> such that10^<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><PRE>#define <B>LDBL_MAX_EXP</B> <I><integer rvalue></I></PRE><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><PRE>#define <B>LDBL_MIN</B> <I><long double rvalue <= 10^(-37)></I></PRE><P>The macro yields the smallest normalized, finite representablevalue of type <I>long double.</I></P><H2><A NAME="LDBL_MIN_10_EXP"><CODE>LDBL_MIN_10_EXP</CODE></A></H2><PRE>#define <B>LDBL_MIN_10_EXP</B> <I><integer rvalue <= -37></I></PRE><P>The macro yields the minimum integer <I>X,</I> such that10^<I>X</I> is a normalized, finite representable valueof type <I>long double.</I></P><H2><A NAME="LDBL_MIN_EXP"><CODE>LDBL_MIN_EXP</CODE></A></H2><PRE>#define <B>LDBL_MIN_EXP</B> <I><integer rvalue></I></PRE><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">Table of Contents</A></B> and the<B><A HREF="_index.html">Index</A></B>.</P><P><I><A HREF="crit_pb.html">Copyright</A> © 1989-2002by P.J. Plauger and Jim Brodie. All rights reserved.</I></P><!--V4.01:1125--></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -