📄 math.h.html
字号:
<!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-2003 The Open Group, All Rights Reserved --><title><math.h></title></head><body bgcolor="white"><script type="text/javascript" language="JavaScript" src="../jscript/codes.js"></script><basefont size="3"> <a name="<math.h>"></a> <a name="tag_13_26"></a><!-- <math.h> --> <!--header start--><center><font size="2">The Open Group Base Specifications Issue 6<br>IEEE Std 1003.1, 2003 Edition<br>Copyright © 2001-2003 The IEEE and The Open Group, All Rights reserved.</font></center><!--header end--><hr size="2" noshade><h4><a name="tag_13_26_01"></a>NAME</h4><blockquote>math.h - mathematical declarations</blockquote><h4><a name="tag_13_26_02"></a>SYNOPSIS</h4><blockquote class="synopsis"><p><tt>#include <math.h></tt></p></blockquote><h4><a name="tag_13_26_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"> Some of the functionality described on this reference page extends the ISO C standard. Applications shall definethe appropriate feature test macro (see the System Interfaces volume of IEEE Std 1003.1-2001, <a href="../functions/xsh_chap02_02.html">Section 2.2, The Compilation Environment</a>) to enable the visibility of these symbols in thisheader. <img src="../images/opt-end.gif" alt="[Option End]" border="0"></div><p>The <i><math.h></i> header shall include definitions for at least the following types:</p><dl compact><dt><b>float_t</b></dt><dd>A real-floating type at least as wide as <b>float</b>.</dd><dt><b>double_t</b></dt><dd>A real-floating type at least as wide as <b>double</b>, and at least as wide as <b>float_t</b>.</dd></dl><p>If FLT_EVAL_METHOD equals 0, <b>float_t</b> and <b>double_t</b> shall be <b>float</b> and <b>double</b>, respectively; ifFLT_EVAL_METHOD equals 1, they shall both be <b>double</b>; if FLT_EVAL_METHOD equals 2, they shall both be <b>long double</b>; forother values of FLT_EVAL_METHOD, they are otherwise implementation-defined.</p><p>The <i><math.h></i> header shall define the following macros, where real-floating indicates that the argument shall be anexpression of real-floating type:</p><pre><tt>int fpclassify(real-floating x);int isfinite(real-floating x);int isinf(real-floating x);int isnan(real-floating x);int isnormal(real-floating x);int signbit(real-floating x);int isgreater(real-floating x, real-floating y);int isgreaterequal(real-floating x, real-floating y);int isless(real-floating x, real-floating y);int islessequal(real-floating x, real-floating y);int islessgreater(real-floating x, real-floating y);int isunordered(real-floating x, real-floating y);</tt></pre><p>The <i><math.h></i> header shall provide for the following constants. The values are of type <b>double</b> and areaccurate within the precision of the <b>double</b> type.</p><dl compact><dt>M_E</dt><dd><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">Value of <i>e</i></dd><dt>M_LOG2E</dt><dd>Value of log<small><sub>2</sub></small><i>e</i></dd><dt>M_LOG10E</dt><dd>Value of log<small><sub>10</sub></small><i>e</i></dd><dt>M_LN2</dt><dd>Value of log<small><sub>e</sub></small>2</dd><dt>M_LN10</dt><dd>Value of log<small><sub>e</sub></small>10</dd><dt>M_PI</dt><dd>Value of <sub><img src="../images/pi.gif"></sub></dd><dt>M_PI_2</dt><dd>Value of <sub><img src="../images/pi.gif"></sub>/2</dd><dt>M_PI_4</dt><dd>Value of <sub><img src="../images/pi.gif"></sub>/4</dd><dt>M_1_PI</dt><dd>Value of 1/<sub><img src="../images/pi.gif"></sub></dd><dt>M_2_PI</dt><dd>Value of 2/<sub><img src="../images/pi.gif"></sub></dd><dt>M_2_SQRTPI</dt><dd>Value of 2/ <sub><img src="../images/sqrt2.gif"><img src="../images/pi.gif"></sub></dd><dt>M_SQRT2</dt><dd>Value of <sub><img src="../images/sqrt2.gif"></sub>2</dd><dt>M_SQRT1_2</dt><dd>Value of 1/<sub><img src="../images/sqrt2.gif"></sub>2 <img src="../images/opt-end.gif" alt="[Option End]" border="0"></dd></dl><p>The header shall define the following symbolic constants:</p><dl compact><dt>MAXFLOAT</dt><dd><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">Value of maximum non-infinite single-precision floating-point number. <img src="../images/opt-end.gif" alt="[Option End]" border="0"></dd><dt>HUGE_VAL</dt><dd>A positive <b>double</b> expression, not necessarily representable as a <b>float</b>. Used as an error value returned by themathematics library. HUGE_VAL evaluates to +infinity on systems supporting IEEE Std 754-1985.</dd><dt>HUGE_VALF</dt><dd>A positive <b>float</b> constant expression. Used as an error value returned by the mathematics library. HUGE_VALF evaluates to+infinity on systems supporting IEEE Std 754-1985.</dd><dt>HUGE_VALL</dt><dd>A positive <b>long double</b> constant expression. Used as an error value returned by the mathematics library. HUGE_VALLevaluates to +infinity on systems supporting IEEE Std 754-1985.</dd><dt>INFINITY</dt><dd>A constant expression of type <b>float</b> representing positive or unsigned infinity, if available; else a positive constantof type <b>float</b> that overflows at translation time.</dd><dt>NAN</dt><dd>A constant expression of type <b>float</b> representing a quiet NaN. This symbolic constant is only defined if theimplementation supports quiet NaNs for the <b>float</b> type.</dd></dl><p>The following macros shall be defined for number classification. They represent the mutually-exclusive kinds of floating-pointvalues. They expand to integer constant expressions with distinct values. Additional implementation-defined floating-pointclassifications, with macro definitions beginning with FP_ and an uppercase letter, may also be specified by theimplementation.</p><blockquote><pre>FP_INFINITEFP_NANFP_NORMALFP_SUBNORMALFP_ZERO</pre></blockquote><p>The following optional macros indicate whether the <a href="../functions/fma.html"><i>fma</i>()</a> family of functions are fastcompared with direct code:</p><blockquote><pre>FP_FAST_FMAFP_FAST_FMAFFP_FAST_FMAL</pre></blockquote><p>The FP_FAST_FMA macro shall be defined to indicate that the <a href="../functions/fma.html"><i>fma</i>()</a> function generallyexecutes about as fast as, or faster than, a multiply and an add of <b>double</b> operands. The other macros have the equivalentmeaning for the <b>float</b> and <b>long double</b> versions.</p><p>The following macros shall expand to integer constant expressions whose values are returned by <i>ilogb</i>( <i>x</i>) if<i>x</i> is zero or NaN, respectively. The value of FP_ILOGB0 shall be either {INT_MIN} or - {INT_MAX}. The value of FP_ILOGBNANshall be either {INT_MAX} or {INT_MIN}.</p><blockquote><pre>FP_ILOGB0FP_ILOGBNAN</pre></blockquote><p>The following macros shall expand to the integer constants 1 and 2, respectively;</p><blockquote><pre>MATH_ERRNOMATH_ERREXCEPT</pre></blockquote><p>The following macro shall expand to an expression that has type <b>int</b> and the value MATH_ERRNO, MATH_ERREXCEPT, or thebitwise-inclusive OR of both:</p><blockquote><pre>math_errhandling</pre></blockquote><p>The value of math_errhandling is constant for the duration of the program. It is unspecified whether math_errhandling is a macroor an identifier with external linkage. If a macro definition is suppressed or a program defines an identifier with the namemath_errhandling , the behavior is undefined. If the expression (math_errhandling & MATH_ERREXCEPT) can be non-zero, theimplementation shall define the macros FE_DIVBYZERO, FE_INVALID, and FE_OVERFLOW in <a href="../basedefs/fenv.h.html"><i><fenv.h></i></a>.</p><p>The following shall be declared as functions and may also be defined as macros. Function prototypes shall be provided.</p><pre><tt>double acos(double);float acosf(float);double acosh(double);float acoshf(float);long double acoshl(long double);long double acosl(long double);double asin(double);float asinf(float);double asinh(double);float asinhf(float);long double asinhl(long double);long double asinl(long double);double atan(double);double atan2(double, double);float atan2f(float, float);long double atan2l(long double, long double);float atanf(float);double atanh(double);float atanhf(float);long double atanhl(long double);long double atanl(long double);double cbrt(double);float cbrtf(float);long double cbrtl(long double);double ceil(double);float ceilf(float);long double ceill(long double);double copysign(double, double);float copysignf(float, float);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -