<!DOCTYPE html>
<html class="client-nojs vector-feature-language-in-header-enabled vector-feature-language-in-main-menu-disabled vector-feature-language-in-main-page-header-disabled vector-feature-page-tools-pinned-disabled vector-feature-toc-pinned-clientpref-0 vector-toc-not-available vector-feature-main-menu-pinned-disabled vector-feature-limited-width-clientpref-1 vector-feature-limited-width-content-enabled vector-feature-custom-font-size-clientpref-1 vector-feature-appearance-pinned-clientpref-0 skin-theme-clientpref-os vector-sticky-header-enabled skin-thumbsize-clientpref-standard" lang="zh" dir="ltr"><head>
    <meta charset="UTF-8">
    <title>Math.h</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="icon" type="image/png" href="./_res_/favicon.png">
    <link rel="canonical" href="https://zh.wikipedia.org/wiki/Math.h"> <link href="./_mw_/ext.math.styles.css" rel="stylesheet" type="text/css">
    <link href="./_mw_/ext.wikimediamessages.styles.css" rel="stylesheet" type="text/css">
    <link href="./_mw_/skins.vector.icons.css" rel="stylesheet" type="text/css">
    <link href="./_mw_/skins.vector.search.codex.styles.css" rel="stylesheet" type="text/css">
    <link href="./_mw_/skins.vector.styles.css" rel="stylesheet" type="text/css">
    <meta name="ResourceLoaderDynamicStyles" content="">
    <link href="./_mw_/ext.gadget.large-font.css" rel="stylesheet" type="text/css">
    <link href="./_mw_/ext.gadget.text-spacing.css" rel="stylesheet" type="text/css">
    <link rel="stylesheet" type="text/css" href="./_mw_/site.styles.css">
    <link rel="stylesheet" type="text/css" href="./_mw_/noscript.css">
    <link rel="stylesheet" type="text/css" href="./_res_/footer.css">
    <link rel="stylesheet" type="text/css" href="./_res_/vector-2022.css">
  </head>
  <body class="skin--responsive skin-vector skin-vector-search-vue mediawiki ltr sitedir-ltr mw-hide-empty-elt ns-0 ns-subject page-Math_h rootpage-Math_h skin-vector-2022 action-view">
    <div class="mw-page-container">
      <div class="mw-page-container-inner">
        <div class="mw-content-container">
          <main id="content" class="mw-body">
            <header class="mw-body-header vector-page-titlebar">
              <h1 id="firstHeading" class="firstHeading mw-first-heading">math.h</h1>
            </header>
            <a id="top"></a>
            <div id="bodyContent" class="vector-body ve-init-mw-desktopArticleTarget-targetContainer" aria-labelledby="firstHeading" data-mw-ve-target-container="">
              <div id="contentSub">
                <div id="mw-content-subtitle"></div>
              </div>
              <div id="mw-content-text" class="mw-body-content mw-content-ltr" lang="zh" dir="ltr"><div class="mw-content-ltr mw-parser-output" lang="zh" dir="ltr"><p class="mw-empty-elt">
</p>
<div id="noteTA-307af9e9" class="noteTA"><div class="noteTA-group"><div data-noteta-group-source="module" data-noteta-group="Math"></div></div></div>
<style data-mw-deduplicate="TemplateStyles:r84265675">
/* start https://zh.wikipedia.org/ */


.mw-parser-output .hlist dl,.mw-parser-output .hlist ol,.mw-parser-output .hlist ul{margin:0;padding:0}.mw-parser-output .hlist dd,.mw-parser-output .hlist dt,.mw-parser-output .hlist li{margin:0;display:inline}.mw-parser-output .hlist.inline,.mw-parser-output .hlist.inline dl,.mw-parser-output .hlist.inline ol,.mw-parser-output .hlist.inline ul,.mw-parser-output .hlist dl dl,.mw-parser-output .hlist dl ol,.mw-parser-output .hlist dl ul,.mw-parser-output .hlist ol dl,.mw-parser-output .hlist ol ol,.mw-parser-output .hlist ol ul,.mw-parser-output .hlist ul dl,.mw-parser-output .hlist ul ol,.mw-parser-output .hlist ul ul{display:inline}.mw-parser-output .hlist .mw-empty-li{display:none}.mw-parser-output .hlist dt::after{content:" :"}.mw-parser-output .hlist dd::after,.mw-parser-output .hlist li::after{content:" · ";font-weight:bold}.mw-parser-output .hlist-pipe dd::after,.mw-parser-output .hlist-pipe li::after{content:" | ";font-weight:normal}.mw-parser-output .hlist-hyphen dd::after,.mw-parser-output .hlist-hyphen li::after{content:" - ";font-weight:normal}.mw-parser-output .hlist-comma dd::after,.mw-parser-output .hlist-comma li::after{content:"、";font-weight:normal}.mw-parser-output .hlist dd:last-child::after,.mw-parser-output .hlist dt:last-child::after,.mw-parser-output .hlist li:last-child::after{content:none}.mw-parser-output .hlist ol{counter-reset:listitem}.mw-parser-output .hlist ol>li{counter-increment:listitem}.mw-parser-output .hlist ol>li::before{content:" "counter(listitem)"\a0 "}.mw-parser-output .hlist dd ol>li:first-child::before,.mw-parser-output .hlist dt ol>li:first-child::before,.mw-parser-output .hlist li ol>li:first-child::before{content:"（"counter(listitem)"\a0 "}.mw-parser-output ul.cslist,.mw-parser-output ul.sslist{margin:0;padding:0;display:inline-block;list-style:none}.mw-parser-output .cslist li,.mw-parser-output .sslist li{margin:0;display:inline-block}.mw-parser-output .cslist li::after{content:"，"}.mw-parser-output .sslist li::after{content:"；"}.mw-parser-output .cslist li:last-child::after,.mw-parser-output .sslist li:last-child::after{content:none}


/* end   https://zh.wikipedia.org/ */
</style><style data-mw-deduplicate="TemplateStyles:r84913072">
/* start https://zh.wikipedia.org/ */


.mw-parser-output .sidebar{width:22em;float:right;clear:right;margin:0.5em 0 1em 1em;background:var(--background-color-neutral-subtle,#f8f9fa);border:1px solid var(--border-color-base,#a2a9b1);padding:0.2em;text-align:center;line-height:1.4em;font-size:88%;border-collapse:collapse;display:table}body.skin-minerva .mw-parser-output .sidebar{display:table!important;float:right!important;margin:0.5em 0 1em 1em!important}.mw-parser-output .sidebar-subgroup{width:100%;margin:0;border-spacing:0}.mw-parser-output .sidebar-left{float:left;clear:left;margin:0.5em 1em 1em 0}.mw-parser-output .sidebar-none{float:none;clear:both;margin:0.5em 1em 1em 0}.mw-parser-output .sidebar-outer-title{padding:0 0.4em 0.2em;font-size:125%;line-height:1.2em;font-weight:bold}.mw-parser-output .sidebar-top-image{padding:0.4em}.mw-parser-output .sidebar-top-caption,.mw-parser-output .sidebar-pretitle-with-top-image,.mw-parser-output .sidebar-caption{padding:0.2em 0.4em 0;line-height:1.2em}.mw-parser-output .sidebar-pretitle{padding:0.4em 0.4em 0;line-height:1.2em}.mw-parser-output .sidebar-title,.mw-parser-output .sidebar-title-with-pretitle{padding:0.2em 0.8em;font-size:145%;line-height:1.2em}.mw-parser-output .sidebar-title-with-pretitle{padding:0.1em 0.4em}.mw-parser-output .sidebar-image{padding:0.2em 0.4em 0.4em}.mw-parser-output .sidebar-heading{padding:0.1em 0.4em}.mw-parser-output .sidebar-content{padding:0 0.5em 0.4em}.mw-parser-output .sidebar-content-with-subgroup{padding:0.1em 0.4em 0.2em}.mw-parser-output .sidebar-above,.mw-parser-output .sidebar-below{padding:0.3em 0.8em;font-weight:bold}.mw-parser-output .sidebar-collapse .sidebar-above,.mw-parser-output .sidebar-collapse .sidebar-below{border-top:1px solid #aaa;border-bottom:1px solid #aaa}.mw-parser-output .sidebar-navbar{text-align:right;font-size:100%;padding:0 0.4em 0.4em}.mw-parser-output .sidebar-list-title{padding:0 0.4em;text-align:left;font-weight:bold;line-height:1.6em;font-size:105%}.mw-parser-output .sidebar-list-title-c{padding:0 0.4em;text-align:center;margin:0 3.3em}@media(max-width:640px){body.mediawiki .mw-parser-output .sidebar{width:100%!important;clear:both;float:none!important;margin-left:0!important;margin-right:0!important}}body.skin--responsive .mw-parser-output .sidebar a>img{max-width:none!important}@media screen{html.skin-theme-clientpref-night .mw-parser-output .sidebar:not(.notheme) .sidebar-list-title,html.skin-theme-clientpref-night .mw-parser-output .sidebar:not(.notheme) .sidebar-subgroup,html.skin-theme-clientpref-night .mw-parser-output .sidebar:not(.notheme) .sidebar-pretitle,html.skin-theme-clientpref-night .mw-parser-output .sidebar:not(.notheme) .sidebar-title,html.skin-theme-clientpref-night .mw-parser-output .sidebar:not(.notheme) .sidebar-title-with-pretitle,html.skin-theme-clientpref-night .mw-parser-output .sidebar:not(.notheme) .sidebar-heading,html.skin-theme-clientpref-night .mw-parser-output .sidebar:not(.notheme) .sidebar-above,html.skin-theme-clientpref-night .mw-parser-output .sidebar:not(.notheme) .sidebar-below{background:inherit!important;color:inherit!important;border-color:#54595d!important}html.skin-theme-clientpref-night .mw-parser-output .sidebar a:not(.new):not(.mw-selflink):link{color:var(--color-progressive)!important}}@media screen and (prefers-color-scheme:dark){html.skin-theme-clientpref-os .mw-parser-output .sidebar:not(.notheme) .sidebar-list-title,html.skin-theme-clientpref-os .mw-parser-output .sidebar:not(.notheme) .sidebar-subgroup,html.skin-theme-clientpref-os .mw-parser-output .sidebar:not(.notheme) .sidebar-pretitle,html.skin-theme-clientpref-os .mw-parser-output .sidebar:not(.notheme) .sidebar-title,html.skin-theme-clientpref-os .mw-parser-output .sidebar:not(.notheme) .sidebar-title-with-pretitle,html.skin-theme-clientpref-os .mw-parser-output .sidebar:not(.notheme) .sidebar-heading,html.skin-theme-clientpref-os .mw-parser-output .sidebar:not(.notheme) .sidebar-above,html.skin-theme-clientpref-os .mw-parser-output .sidebar:not(.notheme) .sidebar-below{background:inherit!important;color:inherit!important;border-color:#54595d!important}html.skin-theme-clientpref-os .mw-parser-output .sidebar a:not(.new):not(.mw-selflink):link{color:var(--color-progressive)!important}}@media print{body.ns-0 .mw-parser-output .sidebar{display:none!important}}


/* end   https://zh.wikipedia.org/ */
</style><table class="sidebar nomobile nowraplinks"><tbody><tr><th class="sidebar-title"><a href="C%E6%A8%99%E6%BA%96%E5%87%BD%E5%BC%8F%E5%BA%AB" title="C標準函式庫">C标准函数库</a></th></tr><tr><th class="sidebar-heading">
一般</th></tr><tr><td class="sidebar-content" style="text-align: left">
<ul><li><a href="Stdlib.h#数据类型" title="Stdlib.h">数据类型</a></li>
<li><a href="Ctype.h" title="Ctype.h">字符类型</a></li>
<li><a href="String.h" title="String.h">字符串</a></li>
<li><a class="mw-selflink selflink">数学</a></li>
<li><a href="Stdio.h" title="Stdio.h">文件输入/输出</a></li>
<li><a href="Time.h" title="Time.h">日期/时间</a></li>
<li><a href="Locale.h" title="Locale.h">本地化</a></li>
<li><a href="Stdlib.h#函数" title="Stdlib.h">内存分配</a></li>
<li><a href="Stdlib.h#函数" title="Stdlib.h">过程控制</a></li>
<li><a href="Signal.h" title="Signal.h">信号</a></li>
<li><a href="C%E6%9B%BF%E4%BB%A3%E6%A0%87%E8%AE%B0" title="C替代标记">替代标记</a></li></ul></td>
</tr><tr><th class="sidebar-heading">
杂项</th></tr><tr><td class="sidebar-content" style="text-align: left">
<ul><li><code>&lt;<a href="Assert.h" title="Assert.h">assert.h</a>&gt;</code></li>
<li><code>&lt;<a href="Errno.h" title="Errno.h">errno.h</a>&gt;</code></li>
<li><code>&lt;<a href="Setjmp.h" title="Setjmp.h">setjmp.h</a>&gt;</code></li>
<li><code>&lt;<a href="Stdarg.h" title="Stdarg.h">stdarg.h</a>&gt;</code></li></ul></td>
</tr><tr><td class="sidebar-navbar" style="line-height:1.6"><style data-mw-deduplicate="TemplateStyles:r84244141">
/* start https://zh.wikipedia.org/ */


.mw-parser-output .navbar{display:inline;font-weight:normal}.mw-parser-output .navbar-collapse{float:left;text-align:left}.mw-parser-output .navbar-boxtext{word-spacing:0}.mw-parser-output .navbar ul{display:inline-block;white-space:nowrap;line-height:inherit}.mw-parser-output .navbar-brackets::before{margin-right:-0.125em;content:"[ "}.mw-parser-output .navbar-brackets::after{margin-left:-0.125em;content:" ]"}.mw-parser-output .navbar li{word-spacing:-0.125em}.mw-parser-output .navbar a>span,.mw-parser-output .navbar a>abbr{text-decoration:inherit}.mw-parser-output .navbar-mini abbr{font-variant:small-caps;border-bottom:none;text-decoration:none;cursor:inherit}.mw-parser-output .navbar-ct-full{font-size:110%;margin:0 8em}.mw-parser-output .navbar-ct-mini{font-size:110%;margin:0 5em}html.skin-theme-clientpref-night .mw-parser-output .navbar li a abbr{color:var(--color-base)!important}@media(prefers-color-scheme:dark){html.skin-theme-clientpref-os .mw-parser-output .navbar li a abbr{color:var(--color-base)!important}}@media print{.mw-parser-output .navbar{display:none!important}}


/* end   https://zh.wikipedia.org/ */
</style></td></tr></tbody></table> 
<p><code>math.h</code>是<a href="C%E6%A8%99%E6%BA%96%E5%87%BD%E6%95%B8%E5%BA%AB" class="mw-redirect" title="C標準函數庫">C標準函数庫</a>中的<a href="%E5%A4%B4%E6%96%87%E4%BB%B6" title="头文件">头文件</a>（<a href="%E5%A4%B4%E6%96%87%E4%BB%B6" title="头文件">標頭檔</a>）。提供用于常用<a href="%E9%AB%98%E7%AD%89%E6%95%B0%E5%AD%A6" title="高等数学">高级数学运算</a>的运算函数。
</p>

<div class="mw-heading mw-heading2"><h2 id="包含的函數原形"><span id=".E5.8C.85.E5.90.AB.E7.9A.84.E5.87.BD.E6.95.B8.E5.8E.9F.E5.BD.A2"></span>包含的函數原形</h2></div>
<div class="mw-heading mw-heading3"><h3 id="三角函數類"><span id=".E4.B8.89.E8.A7.92.E5.87.BD.E6.95.B8.E9.A1.9E"></span><a href="%E4%B8%89%E8%A7%92%E5%87%BD%E6%95%B0" title="三角函数">三角函數</a>類</h3></div>
<table class="wikitable">
<tbody><tr>
<th><a href="%E5%87%BD%E6%95%B0%E5%8E%9F%E5%9E%8B" title="函数原型">函数原型</a>
</th>
<th>描述
</th></tr>
<tr>
<td><code>double sin(double);</code>
</td>
<td><a href="%E6%AD%A3%E5%BC%A6" title="正弦">正弦</a>
</td></tr>
<tr>
<td><code>double cos(double);</code>
</td>
<td><a href="%E4%BD%99%E5%BC%A6" class="mw-redirect" title="余弦">餘弦</a>
</td></tr>
<tr>
<td><code>double tan(double);</code>
</td>
<td><a href="%E6%AD%A3%E5%88%87" title="正切">正切</a>
</td></tr>
<tr>
<td><code>double asin(double);</code>
</td>
<td><a href="%E5%8F%8D%E6%AD%A3%E5%BC%A6" title="反正弦">反正弦</a>，结果介于 <span class="mwe-math-element mwe-math-element-inline"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle [-{\frac {\pi }{2}},{\frac {\pi }{2}}]}">
  <semantics>
    <mrow class="MJX-TeXAtom-ORD">
      <mstyle displaystyle="true" scriptlevel="0">
        <mo stretchy="false">[</mo>
        <mo>−<!-- − --></mo>
        <mrow class="MJX-TeXAtom-ORD">
          <mfrac>
            <mi>π<!-- π --></mi>
            <mn>2</mn>
          </mfrac>
        </mrow>
        <mo>,</mo>
        <mrow class="MJX-TeXAtom-ORD">
          <mfrac>
            <mi>π<!-- π --></mi>
            <mn>2</mn>
          </mfrac>
        </mrow>
        <mo stretchy="false">]</mo>
      </mstyle>
    </mrow>
    <annotation encoding="application/x-tex">{\displaystyle [-{\frac {\pi }{2}},{\frac {\pi }{2}}]}</annotation>
  </semantics>
</math></span><img src="./_assets_/eb734a37dd21ce173a46342d1cc64c92/9dc480741da18128936a24486e90845e818ee6ff.svg" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -1.838ex; width:8.472ex; height:4.676ex;" alt="{\displaystyle [-{\frac {\pi }{2}},{\frac {\pi }{2}}]}" loading="lazy"></span>
</td></tr>
<tr>
<td><code>double acos(double);</code>
</td>
<td><a href="%E5%8F%8D%E9%A4%98%E5%BC%A6" title="反餘弦">反餘弦</a>，结果介于<span class="mwe-math-element mwe-math-element-inline"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle [0,\pi ]}">
  <semantics>
    <mrow class="MJX-TeXAtom-ORD">
      <mstyle displaystyle="true" scriptlevel="0">
        <mo stretchy="false">[</mo>
        <mn>0</mn>
        <mo>,</mo>
        <mi>π<!-- π --></mi>
        <mo stretchy="false">]</mo>
      </mstyle>
    </mrow>
    <annotation encoding="application/x-tex">{\displaystyle [0,\pi ]}</annotation>
  </semantics>
</math></span><img src="./_assets_/eb734a37dd21ce173a46342d1cc64c92/3e2a912eda6ef1afe46a81b518fe9da64a832751.svg" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.838ex; width:4.822ex; height:2.843ex;" alt="{\displaystyle [0,\pi ]}" loading="lazy"></span>
</td></tr>
<tr>
<td><code>double atan(double);</code>
</td>
<td><a href="%E5%8F%8D%E6%AD%A3%E5%88%87" title="反正切">反正切</a>（主值），结果介于 <span class="mwe-math-element mwe-math-element-inline"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle [-{\frac {\pi }{2}},{\frac {\pi }{2}}]}">
  <semantics>
    <mrow class="MJX-TeXAtom-ORD">
      <mstyle displaystyle="true" scriptlevel="0">
        <mo stretchy="false">[</mo>
        <mo>−<!-- − --></mo>
        <mrow class="MJX-TeXAtom-ORD">
          <mfrac>
            <mi>π<!-- π --></mi>
            <mn>2</mn>
          </mfrac>
        </mrow>
        <mo>,</mo>
        <mrow class="MJX-TeXAtom-ORD">
          <mfrac>
            <mi>π<!-- π --></mi>
            <mn>2</mn>
          </mfrac>
        </mrow>
        <mo stretchy="false">]</mo>
      </mstyle>
    </mrow>
    <annotation encoding="application/x-tex">{\displaystyle [-{\frac {\pi }{2}},{\frac {\pi }{2}}]}</annotation>
  </semantics>
</math></span><img src="./_assets_/eb734a37dd21ce173a46342d1cc64c92/9dc480741da18128936a24486e90845e818ee6ff.svg" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -1.838ex; width:8.472ex; height:4.676ex;" alt="{\displaystyle [-{\frac {\pi }{2}},{\frac {\pi }{2}}]}" loading="lazy"></span>
</td></tr>
<tr>
<td><code>double atan2(double, double);</code>
</td>
<td><a href="Atan2" title="Atan2">反正切</a>（整圆值），结果介于<span class="mwe-math-element mwe-math-element-inline"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle [-\pi ,\pi ]}">
  <semantics>
    <mrow class="MJX-TeXAtom-ORD">
      <mstyle displaystyle="true" scriptlevel="0">
        <mo stretchy="false">[</mo>
        <mo>−<!-- − --></mo>
        <mi>π<!-- π --></mi>
        <mo>,</mo>
        <mi>π<!-- π --></mi>
        <mo stretchy="false">]</mo>
      </mstyle>
    </mrow>
    <annotation encoding="application/x-tex">{\displaystyle [-\pi ,\pi ]}</annotation>
  </semantics>
</math></span><img src="./_assets_/eb734a37dd21ce173a46342d1cc64c92/cb064fd6c55820cfa660eabeeda0f6e3c4935ae6.svg" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.838ex; width:6.8ex; height:2.843ex;" alt="{\displaystyle [-\pi ,\pi ]}" loading="lazy"></span>
</td></tr>
<tr>
<td><code>double sinh(double);</code>
</td>
<td><a href="%E5%8F%8C%E6%9B%B2%E6%AD%A3%E5%BC%A6" class="mw-redirect" title="双曲正弦">双曲正弦</a>
</td></tr>
<tr>
<td><code>double cosh(double);</code>
</td>
<td><a href="%E5%8F%8C%E6%9B%B2%E4%BD%99%E5%BC%A6" class="mw-redirect" title="双曲余弦">双曲余弦</a>
</td></tr>
<tr>
<td><code>double tanh(double);</code>
</td>
<td><a href="%E5%8F%8C%E6%9B%B2%E6%AD%A3%E5%88%87" class="mw-redirect" title="双曲正切">双曲正切</a>
</td></tr></tbody></table>
<div class="mw-heading mw-heading3"><h3 id="指数对数類"><span id=".E6.8C.87.E6.95.B0.E5.AF.B9.E6.95.B0.E9.A1.9E"></span><a href="%E6%8C%87%E6%95%B8%E5%87%BD%E6%95%B8" class="mw-redirect" title="指數函數">指数</a><a href="%E5%AF%B9%E6%95%B0" title="对数">对数</a>類</h3></div>
<table class="wikitable">
<tbody><tr>
<th><a href="%E5%87%BD%E6%95%B0%E5%8E%9F%E5%9E%8B" title="函数原型">函数原型</a>
</th>
<th>描述
</th></tr>
<tr>
<td><code>double exp(double);</code>
</td>
<td><a href="%E6%8C%87%E6%95%B8%E5%87%BD%E6%95%B8" class="mw-redirect" title="指數函數">指數函數</a>
</td></tr>
<tr>
<td><code>double sqrt(double);</code>
</td>
<td>开平方根
</td></tr>
<tr>
<td><code>double log(double);</code>
</td>
<td><a href="%E8%87%AA%E7%84%B6%E5%B0%8D%E6%95%B8" title="自然對數">自然對數</a>
</td></tr>
<tr>
<td><code>double log10(double);</code>
</td>
<td><a href="%E5%B8%B8%E7%94%A8%E5%B0%8D%E6%95%B8" title="常用對數">常用對數</a>
</td></tr>
<tr>
<td><code>double pow(double, double);</code>
</td>
<td>计算 <span class="mwe-math-element mwe-math-element-inline"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle x^{y}}">
  <semantics>
    <mrow class="MJX-TeXAtom-ORD">
      <mstyle displaystyle="true" scriptlevel="0">
        <msup>
          <mi>x</mi>
          <mrow class="MJX-TeXAtom-ORD">
            <mi>y</mi>
          </mrow>
        </msup>
      </mstyle>
    </mrow>
    <annotation encoding="application/x-tex">{\displaystyle x^{y}}</annotation>
  </semantics>
</math></span><img src="./_assets_/eb734a37dd21ce173a46342d1cc64c92/c8561c712e86598255e8434a70affa18ffd7e0dd.svg" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.338ex; width:2.379ex; height:2.343ex;" alt="{\displaystyle x^{y}}" loading="lazy"></span>
</td></tr>
<tr>
<td><code>float powf(float, float);</code>
</td>
<td>功能等同于 pow()，只是输入参数与输出参数皆为单浮点数
</td></tr></tbody></table>
<div class="mw-heading mw-heading3"><h3 id="取整函數"><span id=".E5.8F.96.E6.95.B4.E5.87.BD.E6.95.B8"></span><a href="%E5%8F%96%E6%95%B4%E5%87%BD%E6%95%B0" title="取整函数">取整函數</a></h3></div>
<table class="wikitable">
<tbody><tr>
<th><a href="%E5%87%BD%E6%95%B0%E5%8E%9F%E5%9E%8B" title="函数原型">函数原型</a>
</th>
<th>描述
</th></tr>
<tr>
<td><code>double ceil(double);</code>
</td>
<td><a href="%E5%8F%96%E6%95%B4%E5%87%BD%E6%95%B0" title="取整函数">上取整</a>
</td></tr>
<tr>
<td><code>double floor(double);</code>
</td>
<td><a href="%E5%8F%96%E6%95%B4%E5%87%BD%E6%95%B0" title="取整函数">下取整</a>
</td></tr></tbody></table>
<div class="mw-heading mw-heading3"><h3 id="绝对值"><span id=".E7.BB.9D.E5.AF.B9.E5.80.BC"></span><a href="%E7%BB%9D%E5%AF%B9%E5%80%BC" title="绝对值">绝对值</a></h3></div>
<table class="wikitable">
<tbody><tr>
<th><a href="%E5%87%BD%E6%95%B0%E5%8E%9F%E5%9E%8B" title="函数原型">函数原型</a>
</th>
<th>描述
</th></tr>
<tr>
<td><code>int abs(int);</code>
</td>
<td>求整型的绝对值
</td></tr>
<tr>
<td><code>double fabs(double);</code>
</td>
<td>求<a href="%E7%BB%9D%E5%AF%B9%E5%80%BC" title="绝对值">绝对值</a>
</td></tr>
<tr>
<td><code>double cabs(struct complex);</code>
</td>
<td>求复数的绝对值
</td></tr></tbody></table>
<div class="mw-heading mw-heading3"><h3 id="标准化浮点数"><span id=".E6.A0.87.E5.87.86.E5.8C.96.E6.B5.AE.E7.82.B9.E6.95.B0"></span>标准化<a href="%E6%B5%AE%E7%82%B9%E6%95%B0" class="mw-redirect" title="浮点数">浮点数</a></h3></div>
<table class="wikitable">
<tbody><tr>
<th><a href="%E5%87%BD%E6%95%B0%E5%8E%9F%E5%9E%8B" title="函数原型">函数原型</a>
</th>
<th>描述
</th></tr>
<tr>
<td><code>double frexp(double f, int *p);</code>
</td>
<td>标准化浮点数，<span class="mwe-math-element mwe-math-element-inline"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle f=x*2^{p}}">
  <semantics>
    <mrow class="MJX-TeXAtom-ORD">
      <mstyle displaystyle="true" scriptlevel="0">
        <mi>f</mi>
        <mo>=</mo>
        <mi>x</mi>
        <mo>∗<!-- ∗ --></mo>
        <msup>
          <mn>2</mn>
          <mrow class="MJX-TeXAtom-ORD">
            <mi>p</mi>
          </mrow>
        </msup>
      </mstyle>
    </mrow>
    <annotation encoding="application/x-tex">{\displaystyle f=x*2^{p}}</annotation>
  </semantics>
</math></span><img src="./_assets_/eb734a37dd21ce173a46342d1cc64c92/b6e12ed426cd20d2d856b974b97fdfb40696b2a0.svg" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.671ex; width:10.123ex; height:2.676ex;" alt="{\displaystyle f=x*2^{p}}" loading="lazy"></span>，已知 <span class="mwe-math-element mwe-math-element-inline"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle f}">
  <semantics>
    <mrow class="MJX-TeXAtom-ORD">
      <mstyle displaystyle="true" scriptlevel="0">
        <mi>f</mi>
      </mstyle>
    </mrow>
    <annotation encoding="application/x-tex">{\displaystyle f}</annotation>
  </semantics>
</math></span><img src="./_assets_/eb734a37dd21ce173a46342d1cc64c92/132e57acb643253e7810ee9702d9581f159a1c61.svg" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.671ex; width:1.279ex; height:2.509ex;" alt="{\displaystyle f}" loading="lazy"></span> 求 <span class="mwe-math-element mwe-math-element-inline"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle x,p}">
  <semantics>
    <mrow class="MJX-TeXAtom-ORD">
      <mstyle displaystyle="true" scriptlevel="0">
        <mi>x</mi>
        <mo>,</mo>
        <mi>p</mi>
      </mstyle>
    </mrow>
    <annotation encoding="application/x-tex">{\displaystyle x,p}</annotation>
  </semantics>
</math></span><img src="./_assets_/eb734a37dd21ce173a46342d1cc64c92/b95a7ed3d2b1822eb6a28970329fa7b428219be7.svg" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.671ex; width:3.533ex; height:2.009ex;" alt="{\displaystyle x,p}" loading="lazy"></span> ( <span class="mwe-math-element mwe-math-element-inline"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle x}">
  <semantics>
    <mrow class="MJX-TeXAtom-ORD">
      <mstyle displaystyle="true" scriptlevel="0">
        <mi>x</mi>
      </mstyle>
    </mrow>
    <annotation encoding="application/x-tex">{\displaystyle x}</annotation>
  </semantics>
</math></span><img src="./_assets_/eb734a37dd21ce173a46342d1cc64c92/87f9e315fd7e2ba406057a97300593c4802b53e4.svg" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.338ex; width:1.33ex; height:1.676ex;" alt="{\displaystyle x}" loading="lazy"></span>介于<span class="mwe-math-element mwe-math-element-inline"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle [0.5,1]}">
  <semantics>
    <mrow class="MJX-TeXAtom-ORD">
      <mstyle displaystyle="true" scriptlevel="0">
        <mo stretchy="false">[</mo>
        <mn>0.5</mn>
        <mo>,</mo>
        <mn>1</mn>
        <mo stretchy="false">]</mo>
      </mstyle>
    </mrow>
    <annotation encoding="application/x-tex">{\displaystyle [0.5,1]}</annotation>
  </semantics>
</math></span><img src="./_assets_/eb734a37dd21ce173a46342d1cc64c92/28b12b2e130f0013fb23a77854afeb5dafbc0d48.svg" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.838ex; width:6.462ex; height:2.843ex;" alt="{\displaystyle [0.5,1]}" loading="lazy"></span> )
</td></tr>
<tr>
<td><code>double ldexp(double x, int p);</code>
</td>
<td>与 frexp() 相反，已知 <span class="mwe-math-element mwe-math-element-inline"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle x,p}">
  <semantics>
    <mrow class="MJX-TeXAtom-ORD">
      <mstyle displaystyle="true" scriptlevel="0">
        <mi>x</mi>
        <mo>,</mo>
        <mi>p</mi>
      </mstyle>
    </mrow>
    <annotation encoding="application/x-tex">{\displaystyle x,p}</annotation>
  </semantics>
</math></span><img src="./_assets_/eb734a37dd21ce173a46342d1cc64c92/b95a7ed3d2b1822eb6a28970329fa7b428219be7.svg" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.671ex; width:3.533ex; height:2.009ex;" alt="{\displaystyle x,p}" loading="lazy"></span> 求 <span class="mwe-math-element mwe-math-element-inline"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle f}">
  <semantics>
    <mrow class="MJX-TeXAtom-ORD">
      <mstyle displaystyle="true" scriptlevel="0">
        <mi>f</mi>
      </mstyle>
    </mrow>
    <annotation encoding="application/x-tex">{\displaystyle f}</annotation>
  </semantics>
</math></span><img src="./_assets_/eb734a37dd21ce173a46342d1cc64c92/132e57acb643253e7810ee9702d9581f159a1c61.svg" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.671ex; width:1.279ex; height:2.509ex;" alt="{\displaystyle f}" loading="lazy"></span>
</td></tr>
</tbody></table>
<div class="mw-heading mw-heading3"><h3 id="取整与取余数"><span id=".E5.8F.96.E6.95.B4.E4.B8.8E.E5.8F.96.E4.BD.99.E6.95.B0"></span><a href="%E5%8F%96%E6%95%B4" class="mw-redirect" title="取整">取整</a>与<a href="%E6%A8%A1%E9%99%A4" title="模除">取余数</a></h3></div>
<table class="wikitable">
<tbody><tr>
<th><a href="%E5%87%BD%E6%95%B0%E5%8E%9F%E5%9E%8B" title="函数原型">函数原型</a>
</th>
<th>描述
</th></tr>
<tr>
<td><code>double modf(double, double *);</code>
</td>
<td>将参数的整数部分通过指针回传，返回小数部分
</td></tr>
<tr>
<td><code>double fmod(double, double);</code>
</td>
<td>返回两参数相除的余数
</td></tr></tbody></table>
<div class="mw-heading mw-heading3"><h3 id="其他"><span id=".E5.85.B6.E4.BB.96"></span>其他</h3></div>
<table class="wikitable">
<tbody><tr>
<th><a href="%E5%87%BD%E6%95%B0%E5%8E%9F%E5%9E%8B" title="函数原型">函数原型</a>
</th>
<th>描述
</th></tr>
<tr>
<td><code>double hypot(double, double);</code>
</td>
<td>已知直角三角形两个直角边长度，求斜边长度
</td></tr>
<tr>
<td><code>double ldexp(double x, int exponent);</code>
</td>
<td>计算<span class="mwe-math-element mwe-math-element-inline"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle x*2^{\text{exponent}}}">
  <semantics>
    <mrow class="MJX-TeXAtom-ORD">
      <mstyle displaystyle="true" scriptlevel="0">
        <mi>x</mi>
        <mo>∗<!-- ∗ --></mo>
        <msup>
          <mn>2</mn>
          <mrow class="MJX-TeXAtom-ORD">
            <mtext>exponent</mtext>
          </mrow>
        </msup>
      </mstyle>
    </mrow>
    <annotation encoding="application/x-tex">{\displaystyle x*2^{\text{exponent}}}</annotation>
  </semantics>
</math></span><img src="./_assets_/eb734a37dd21ce173a46342d1cc64c92/295bd42b3c212b13ab9db197679cfd559d60e7bd.svg" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.338ex; width:11.451ex; height:2.509ex;" alt="{\displaystyle x*2^{\text{exponent}}}" loading="lazy"></span>
</td></tr>
<tr>
<td><code>double poly(double x, int degree, double coeffs []);</code>
</td>
<td>计算多项式
</td></tr>
<tr>
<td><code>int matherr(struct exception *);</code>
</td>
<td>数学错误计算处理程序
</td></tr></tbody></table>
<div class="mw-heading mw-heading2"><h2 id="参考"><span id=".E5.8F.82.E8.80.83"></span>参考</h2></div>
<ul><li>《C &amp; C++ Code Capsules》</li></ul>
</div><!--htdig_noindex--><div><div class="zim-footer">
    This article is issued from <a class="external text" title="Last edited on 2025-06-27" href="https://zh.wikipedia.org/wiki/?title=Math.h&amp;oldid=87949661">Wikipedia</a>. The text is available under <a class="external text" href="https://creativecommons.org/licenses/by-sa/4.0/deed.zh">Creative Commons Attribution-Share Alike 4.0</a> unless otherwise noted. Additional terms may apply for the media files.
</div>
</div><!--/htdig_noindex--></div>
            </div>
          </main>
        </div>
      </div>
    </div>
     <script src="./_webp_/webpHandler.js"></script>
  

</body></html>