📄 all.html
字号:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head> <meta name="generator" content= "HTML Tidy for Linux/x86 (vers 1 September 2005), see www.w3.org"> <title>Standard C Math</title> <link href="../cppreference.css" rel="stylesheet" type="text/css"></head><body><table> <tr> <td> <div class="body-content"> <div class="header-box"> <a href="../index.html">cppreference.com</a> > <a href= "index.html">Standard C Math</a> </div> <div class="name-format"> abs </div> <div class="syntax-name-format"> Syntax: </div> <pre class="syntax-box"> #include <stdlib.h> int abs( int num );</pre> <p>The abs() function returns the absolute value of <em>num</em>. For example:</p> <pre class="example-code"> int magic_number = 10; cout << "Enter a guess: "; cin >> x; cout << "Your guess was " << abs( magic_number - x ) << " away from the magic number." << endl; </pre> <div class="related-name-format"> Related topics: </div> <div class="related-content"> <a href="fabs.html">fabs</a><br> <a href="labs.html">labs</a> </div> </div> </td> </tr> </table></body></html><hr> <div class="name-format"> acos </div> <div class="syntax-name-format"> Syntax: </div> <pre class="syntax-box"> #include <math.h> double acos( double arg );</pre> <p>The acos() function returns the arc cosine of <em>arg</em>, which will be in the range [0, pi]. <em>arg</em> should be between -1 and 1. If <em>arg</em> is outside this range, acos() returns NAN and raises a floating-point exception.</p> <div class="related-name-format"> Related topics: </div> <div class="related-content"> <a href="asin.html">asin</a><br> <a href="atan.html">atan</a><br> <a href="atan2.html">atan2</a><br> <a href="cos.html">cos</a><br> <a href="cosh.html">cosh</a><br> <a href="sin.html">sin</a><br> <a href="sinh.html">sinh</a><br> <a href="tan.html">tan</a><br> <a href="tanh.html">tanh</a> </div> </div> </td> </tr> </table></body></html><hr> <div class="name-format"> asin </div> <div class="syntax-name-format"> Syntax: </div> <pre class="syntax-box"> #include <math.h> double asin( double arg );</pre> <p>The asin() function returns the arc sine of <em>arg</em>, which will be in the range [-pi/2, +pi/2]. <em>arg</em> should be between -1 and 1. If <em>arg</em> is outside this range, asin() returns NAN and raises a floating-point exception.</p> <div class="related-name-format"> Related topics: </div> <div class="related-content"> <a href="acos.html">acos</a><br> <a href="atan.html">atan</a><br> <a href="atan2.html">atan2</a><br> <a href="cos.html">cos</a><br> <a href="cosh.html">cosh</a><br> <a href="sin.html">sin</a><br> <a href="sinh.html">sinh</a><br> <a href="tan.html">tan</a><br> <a href="tanh.html">tanh</a> </div> </div> </td> </tr> </table></body></html><hr> <div class="name-format"> atan </div> <div class="syntax-name-format"> Syntax: </div> <pre class="syntax-box"> #include <math.h> double atan( double arg );</pre> <p>The function atan() returns the arc tangent of <em>arg</em>, which will be in the range [-pi/2, +pi/2].</p> <div class="related-name-format"> Related topics: </div> <div class="related-content"> <a href="acos.html">acos</a><br> <a href="asin.html">asin</a><br> <a href="atan2.html">atan2</a><br> <a href="cos.html">cos</a><br> <a href="cosh.html">cosh</a><br> <a href="sin.html">sin</a><br> <a href="sinh.html">sinh</a><br> <a href="tan.html">tan</a><br> <a href="tanh.html">tanh</a> </div> </div> </td> </tr> </table></body></html><hr> <div class="name-format"> atan2 </div> <div class="syntax-name-format"> Syntax: </div> <pre class="syntax-box"> #include <math.h> double atan2( double y, double x );</pre> <p>The atan2() function computes the arc tangent of <em>y</em>/<em>x</em>, using the signs of the arguments to compute the quadrant of the return value.</p> <p>Note the order of the arguments passed to this function.</p> <div class="related-name-format"> Related topics: </div> <div class="related-content"> <a href="acos.html">acos</a><br> <a href="asin.html">asin</a><br> <a href="atan.html">atan</a><br> <a href="cos.html">cos</a><br> <a href="cosh.html">cosh</a><br> <a href="sin.html">sin</a><br> <a href="sinh.html">sinh</a><br> <a href="tan.html">tan</a><br> <a href="tanh.html">tanh</a> </div> </div> </td> </tr> </table></body></html><hr> <div class="name-format"> ceil </div> <div class="syntax-name-format"> Syntax: </div> <pre class="syntax-box"> #include <math.h> double ceil( double num );</pre> <p>The ceil() function returns the smallest integer no less than <em>num</em>. For example,</p> <pre class="example-code"> y = 6.04; x = ceil( y ); </pre> <p>would set x to 7.0.</p> <div class="related-name-format"> Related topics: </div> <div class="related-content"> <a href="floor.html">floor</a><br> <a href="fmod.html">fmod</a> </div> </div> </td> </tr> </table></body></html><hr> <div class="name-format"> cos </div> <div class="syntax-name-format"> Syntax: </div> <pre class="syntax-box"> #include <math.h> double cos( double arg );</pre> <p>The cos() function returns the cosine of <em>arg</em>, where <em>arg</em> is expressed in radians. The return value of cos() is in the range [-1,1]. If <em>arg</em> is infinite, cos() will return NAN and raise a floating-point exception.</p> <div class="related-name-format"> Related topics: </div> <div class="related-content"> <a href="acos.html">acos</a><br> <a href="asin.html">asin</a><br> <a href="atan.html">atan</a><br> <a href="atan2.html">atan2</a><br> <a href="cosh.html">cosh</a><br> <a href="sin.html">sin</a><br> <a href="sinh.html">sinh</a><br> <a href="tan.html">tan</a><br> <a href="tanh.html">tanh</a> </div> </div> </td> </tr> </table></body></html><hr> <div class="name-format"> cosh </div> <div class="syntax-name-format"> Syntax: </div> <pre class="syntax-box"> #include <math.h> double cosh( double arg );</pre> <p>The function cosh() returns the hyperbolic cosine of <em>arg</em>.</p> <div class="related-name-format"> Related topics: </div> <div class="related-content"> <a href="acos.html">acos</a><br> <a href="asin.html">asin</a><br> <a href="atan.html">atan</a><br> <a href="atan2.html">atan2</a><br> <a href="cos.html">cos</a><br> <a href="sin.html">sin</a><br> <a href="sinh.html">sinh</a><br> <a href="tan.html">tan</a><br> <a href="tanh.html">tanh</a> </div> </div> </td> </tr> </table></body></html><hr> <div class="name-format"> div </div> <div class="syntax-name-format"> Syntax: </div> <pre class="syntax-box"> #include <stdlib.h> <strong>div_t</strong> div( int numerator, int denominator );</pre> <p>The function div() returns the quotient and remainder of the operation <em>numerator</em> / <em>denominator</em>. The <strong>div_t</strong> structure is defined in stdlib.h, and has at least:</p> <pre class="example-code"> int quot; // The quotient int rem; // The remainder </pre> <p>For example, the following code displays the quotient and remainder of x/y:</p> <pre class="example-code"> <strong>div_t</strong> temp; temp = div( x, y ); printf( "%d divided by %d yields %d with a remainder of %d\n", x, y, temp.quot, temp.rem ); </pre> <div class="related-name-format"> Related topics: </div> <div class="related-content"> <a href="ldiv.html">ldiv</a> </div> </div> </td> </tr> </table></body></html><hr> <div class="name-format"> exp </div> <div class="syntax-name-format"> Syntax: </div> <pre class="syntax-box"> #include <math.h> double exp( double arg );</pre> <p>The exp() function returns e (2.7182818) raised to the <em>arg</em>th power.</p> <div class="related-name-format"> Related topics: </div> <div class="related-content"> <a href="log.html">log</a><br> <a href="pow.html">pow</a><br> <a href="sqrt.html">sqrt</a> </div> </div> </td> </tr> </table></body></html><hr> <div class="name-format"> fabs </div> <div class="syntax-name-format"> Syntax: </div> <pre class="syntax-box"> #include <math.h> double fabs( double arg );</pre> <p>The function fabs() returns the absolute value of <em>arg</em>.</p> <div class="related-name-format"> Related topics: </div> <div class="related-content"> <a href="abs.html">abs</a><br> <a href="fmod.html">fmod</a><br> <a href="labs.html">labs</a> </div> </div> </td> </tr> </table></body></html><hr> <div class="name-format"> floor </div> <div class="syntax-name-format"> Syntax: </div> <pre class="syntax-box"> #include <math.h> double floor( double arg );</pre> <p>The function floor() returns the largest integer not greater than <em>arg</em>. For example,</p> <pre class="example-code"> y = 6.04; x = floor( y ); </pre> <p>would result in x being set to 6.0.</p> <div class="related-name-format"> Related topics: </div> <div class="related-content"> <a href="ceil.html">ceil</a><br> <a href="fmod.html">fmod</a> </div> </div> </td> </tr> </table></body></html><hr> <div class="name-format"> fmod </div> <div class="syntax-name-format"> Syntax: </div> <pre class="syntax-box"> #include <math.h> double fmod( double x, double y );</pre>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -