blob: 82bd12e983cda24f4e7246399ed6b47ca3b41865 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
<h1 id="firstHeading" class="firstHeading">Numerics</h1> <p>The C numerics library includes common mathematical functions and types, as well as support for random number generation.</p>
<h3 id="Common_mathematical_functions"> <a href="numeric/math" title="c/numeric/math"> Common mathematical functions</a>
</h3> <p>The header <code>math.h</code> provides <a href="numeric/math" title="c/numeric/math">standard C library mathematical functions</a> such as <code><a href="numeric/math/fabs" title="c/numeric/math/fabs">fabs</a></code>, <code><a href="numeric/math/sqrt" title="c/numeric/math/sqrt">sqrt</a></code>, and <code><a href="numeric/math/sin" title="c/numeric/math/sin">sin</a></code>.</p>
<h3 id="Floating-point_environment"> <a href="numeric/fenv" title="c/numeric/fenv"> Floating-point environment</a>
</h3> <p>The header <code>fenv.h</code> defines <a href="numeric/fenv" title="c/numeric/fenv">flags and functions related to exceptional floating-point state</a>, such as overflow and division by zero.</p>
<h3 id="Pseudo-random_number_generation"> <a href="numeric/random" title="c/numeric/random"> Pseudo-random number generation</a>
</h3> <p>The header <code>stdlib.h</code> also includes C-style random number generation via <code><a href="numeric/random/srand" title="c/numeric/random/srand">srand</a></code> and <code><a href="numeric/random/rand" title="c/numeric/random/rand">rand</a></code>.</p>
<h3 id="Complex_number_arithmetic"> <a href="numeric/complex" title="c/numeric/complex"> Complex number arithmetic</a>
</h3> <p>The header <code>complex.h</code> provides types and functions about <a href="numeric/complex" title="c/numeric/complex">complex numbers</a>.</p>
<h3 id="Type-generic_math"> <a href="numeric/tgmath" title="c/numeric/tgmath"> Type-generic math</a>
</h3> <p>The header <code>tgmath.h</code> provides some macros for a function which names XXX:</p>
<ul>
<li> real function: </li>
<ul>
<li> <code>float</code> variant <code>XXXf</code> </li>
<li> <code>double</code> variant <code>XXX</code> </li>
<li> <code>long double</code> variant <code>XXXl</code> </li>
</ul>
<li> complex function: </li>
<ul>
<li> <code>float</code> variant <code>cXXXf</code> </li>
<li> <code>double</code> variant <code>cXXX</code> </li>
<li> <code>long double</code> variant <code>cXXXl</code> </li>
</ul>
</ul> <h3 id="See_also"> See also</h3> <table class="t-dsc-begin"> <tr class="t-dsc"> <td colspan="2"> <span><a href="https://en.cppreference.com/w/cpp/numeric" title="cpp/numeric">C++ documentation</a></span> for <span class=""><span>Numerics library</span></span> </td>
</tr> </table> <div class="_attribution">
<p class="_attribution-p">
© cppreference.com<br>Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.<br>
<a href="https://en.cppreference.com/w/c/numeric" class="_attribution-link">https://en.cppreference.com/w/c/numeric</a>
</p>
</div>
|