The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"
 lang="en" dir="ltr">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <title>
    Standard C Math    [C++ Reference]
  </title>

  <meta name="generator" content="DokuWiki Release 2009-12-25c &quot;Lemming&quot;" />
<meta name="robots" content="index,follow" />
<meta name="date" content="2008-12-13T06:21:49-0800" />
<meta name="keywords" content="c,math,start" />
<link rel="search" type="application/opensearchdescription+xml" href="/wiki/lib/exe/opensearch.php" title="C++ Reference" />
<link rel="start" href="/wiki/" />
<link rel="contents" href="/wiki/c/math/start?do=index" title="Index" />
<link rel="alternate" type="application/rss+xml" title="Recent Changes" href="/wiki/feed.php" />
<link rel="alternate" type="application/rss+xml" title="Current Namespace" href="/wiki/feed.php?mode=list&amp;ns=c:math" />
<link rel="edit" title="Edit this page" href="/wiki/c/math/start?do=edit" />
<link rel="alternate" type="text/html" title="Plain HTML" href="/wiki/_export/xhtml/c/math/start" />
<link rel="alternate" type="text/plain" title="Wiki Markup" href="/wiki/_export/raw/c/math/start" />
<link rel="canonical" href="http://www.cppreference.com/wiki/c/math/start" />
<link rel="stylesheet" media="all" type="text/css" href="/wiki/lib/exe/css.php?s=all&amp;t=custom1&amp;tseed=1272971091" />
<link rel="stylesheet" media="screen" type="text/css" href="/wiki/lib/exe/css.php?t=custom1&amp;tseed=1272971091" />
<link rel="stylesheet" media="print" type="text/css" href="/wiki/lib/exe/css.php?s=print&amp;t=custom1&amp;tseed=1272971091" />
<script type="text/javascript" charset="utf-8" ><!--//--><![CDATA[//><!--
var NS='c:math';var JSINFO = {"id":"c:math:start","namespace":"c:math"};
//--><!]]></script>
<script type="text/javascript" charset="utf-8" src="/wiki/lib/exe/js.php?tseed=1272971091" ></script>

  <link rel="shortcut icon" href="/wiki/lib/tpl/custom1/images/favicon.png" />

  </head>

<body>
<div class="dokuwiki">
  
  <div class="stylehead">

    <div class="header">
      <div class="pagename">
        [[<a href="../../c/math/start.html"  title="Backlinks">Standard C Math</a>]]
      </div>
      <div class="logo">
        <a href="http://www.cppreference.com"  name="dokuwiki__top" id="dokuwiki__top" accesskey="h" title="[ALT+H]">C++ Reference</a>      </div>

      <div class="clearer"></div>
    </div>

    
    
        <div class="breadcrumbs">
      <span class="bchead">You are here: </span><a href="../../start.html"  title="start">C++ Reference</a> &raquo; <a href="../../c/start.html"  title="c:start">The Standard C Library</a> &raquo; <a href="../../c/math/start.html"  title="c:math:start">Standard C Math</a>    </div>
    
  </div>

<div class="plugin_translation"><span>Translations of this page<sup><a href="../../localization.html" class="wikilink1" title="localization">?</a></sup>:</span> <ul>  <li><div class="li"><span class="curid"><a href="../../c/math/start.html" class="wikilink1" title="c:math:start">en</a></span></div></li>  <li><div class="li"><a href="../../br-pt/c/math/start.html" class="wikilink1" title="br-pt:c:math:start">br-pt</a></div></li>  <li><div class="li"><a href="../../cn/c/math/start.html" class="wikilink1" title="cn:c:math:start">cn</a></div></li>  <li><div class="li"><a href="../../cz/c/math/start.html" class="wikilink2" title="cz:c:math:start" rel="nofollow">cz</a></div></li>  <li><div class="li"><a href="../../de/c/math/start.html" class="wikilink2" title="de:c:math:start" rel="nofollow">de</a></div></li>  <li><div class="li"><a href="../../es/c/math/start.html" class="wikilink2" title="es:c:math:start" rel="nofollow">es</a></div></li>  <li><div class="li"><a href="../../fr/c/math/start.html" class="wikilink2" title="fr:c:math:start" rel="nofollow">fr</a></div></li>  <li><div class="li"><a href="../../it/c/math/start.html" class="wikilink2" title="it:c:math:start" rel="nofollow">it</a></div></li>  <li><div class="li"><a href="../../jp/c/math/start.html" class="wikilink1" title="jp:c:math:start">jp</a></div></li>  <li><div class="li"><a href="../../nl/c/math/start.html" class="wikilink2" title="nl:c:math:start" rel="nofollow">nl</a></div></li>  <li><div class="li"><a href="../../pl/c/math/start.html" class="wikilink1" title="pl:c:math:start">pl</a></div></li>  <li><div class="li"><a href="../../ro/c/math/start.html" class="wikilink2" title="ro:c:math:start" rel="nofollow">ro</a></div></li>  <li><div class="li"><a href="../../ru/c/math/start.html" class="wikilink2" title="ru:c:math:start" rel="nofollow">ru</a></div></li>  <li><div class="li"><a href="../../sk/c/math/start.html" class="wikilink2" title="sk:c:math:start" rel="nofollow">sk</a></div></li>  <li><div class="li"><a href="../../tr/c/math/start.html" class="wikilink2" title="tr:c:math:start" rel="nofollow">tr</a></div></li>  <li><div class="li"><a href="../../tw/c/math/start.html" class="wikilink2" title="tw:c:math:start" rel="nofollow">tw</a></div></li></ul></div>
  
  
  <div class="page">

    <script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
</script>
<script type="text/javascript">
_uacct = "UA-2828341-1";
urchinTracker();
</script>
    <!-- wikipage start -->
    


<h1><a name="standard_c_math" id="standard_c_math">Standard C Math</a></h1>
<div class="level1">
<table class="inline">
	<tr class="row0">
		<td class="col0"><a href="../../c/math/abs.html" class="wikilink1" title="c:math:abs">abs</a></td><td class="col1">absolute value</td>
	</tr>
	<tr class="row1">
		<td class="col0"><a href="../../c/math/acos.html" class="wikilink1" title="c:math:acos">acos</a></td><td class="col1">arc cosine</td>
	</tr>
	<tr class="row2">
		<td class="col0"><a href="../../c/math/asin.html" class="wikilink1" title="c:math:asin">asin</a></td><td class="col1">arc sine</td>
	</tr>
	<tr class="row3">
		<td class="col0"><a href="../../c/math/atan.html" class="wikilink1" title="c:math:atan">atan</a></td><td class="col1">arc tangent</td>
	</tr>
	<tr class="row4">
		<td class="col0"><a href="../../c/math/atan2.html" class="wikilink1" title="c:math:atan2">atan2</a></td><td class="col1">arc tangent, using signs to determine quadrants</td>
	</tr>
	<tr class="row5">
		<td class="col0"><a href="../../c/math/ceil.html" class="wikilink1" title="c:math:ceil">ceil</a></td><td class="col1">the smallest integer not less than a certain value</td>
	</tr>
	<tr class="row6">
		<td class="col0"><a href="../../c/math/cos.html" class="wikilink1" title="c:math:cos">cos</a></td><td class="col1">cosine</td>
	</tr>
	<tr class="row7">
		<td class="col0"><a href="../../c/math/cosh.html" class="wikilink1" title="c:math:cosh">cosh</a></td><td class="col1">hyperbolic cosine</td>
	</tr>
	<tr class="row8">
		<td class="col0"><a href="../../c/math/div.html" class="wikilink1" title="c:math:div">div</a></td><td class="col1">returns the quotient and remainder of a division</td>
	</tr>
	<tr class="row9">
		<td class="col0"><a href="../../c/math/exp.html" class="wikilink1" title="c:math:exp">exp</a></td><td class="col1">returns ā€œeā€ raised to a given power</td>
	</tr>
	<tr class="row10">
		<td class="col0"><a href="../../c/math/fabs.html" class="wikilink1" title="c:math:fabs">fabs</a></td><td class="col1">absolute value for floating-point numbers</td>
	</tr>
	<tr class="row11">
		<td class="col0"><a href="../../c/math/floor.html" class="wikilink1" title="c:math:floor">floor</a></td><td class="col1">returns the largest integer not greater than a given value</td>
	</tr>
	<tr class="row12">
		<td class="col0"><a href="../../c/math/fmod.html" class="wikilink1" title="c:math:fmod">fmod</a></td><td class="col1">returns the remainder of a division</td>
	</tr>
	<tr class="row13">
		<td class="col0"><a href="../../c/math/frexp.html" class="wikilink1" title="c:math:frexp">frexp</a></td><td class="col1">decomposes a number into scientific notation</td>
	</tr>
	<tr class="row14">
		<td class="col0"><a href="../../c/math/labs.html" class="wikilink1" title="c:math:labs">labs</a></td><td class="col1">absolute value for long integers</td>
	</tr>
	<tr class="row15">
		<td class="col0"><a href="../../c/math/ldexp.html" class="wikilink1" title="c:math:ldexp">ldexp</a></td><td class="col1">computes a number in scientific notation</td>
	</tr>
	<tr class="row16">
		<td class="col0"><a href="../../c/math/ldiv.html" class="wikilink1" title="c:math:ldiv">ldiv</a></td><td class="col1">returns the quotient and remainder of a division, in long integer form</td>
	</tr>
	<tr class="row17">
		<td class="col0"><a href="../../c/math/log.html" class="wikilink1" title="c:math:log">log</a></td><td class="col1">natural logarithm (to base e)</td>
	</tr>
	<tr class="row18">
		<td class="col0"><a href="../../c/math/log10.html" class="wikilink1" title="c:math:log10">log10</a></td><td class="col1">common logarithm (to base 10)</td>
	</tr>
	<tr class="row19">
		<td class="col0"><a href="../../c/math/modf.html" class="wikilink1" title="c:math:modf">modf</a></td><td class="col1">decomposes a number into integer and fractional parts</td>
	</tr>
	<tr class="row20">
		<td class="col0"><a href="../../c/math/pow.html" class="wikilink1" title="c:math:pow">pow</a></td><td class="col1">returns a given number raised to another number</td>
	</tr>
	<tr class="row21">
		<td class="col0"><a href="../../c/math/sin.html" class="wikilink1" title="c:math:sin">sin</a></td><td class="col1">sine</td>
	</tr>
	<tr class="row22">
		<td class="col0"><a href="../../c/math/sinh.html" class="wikilink1" title="c:math:sinh">sinh</a></td><td class="col1">hyperbolic sine</td>
	</tr>
	<tr class="row23">
		<td class="col0"><a href="../../c/math/sqrt.html" class="wikilink1" title="c:math:sqrt">sqrt</a></td><td class="col1">square root</td>
	</tr>
	<tr class="row24">
		<td class="col0"><a href="../../c/math/tan.html" class="wikilink1" title="c:math:tan">tan</a></td><td class="col1">tangent</td>
	</tr>
	<tr class="row25">
		<td class="col0"><a href="../../c/math/tanh.html" class="wikilink1" title="c:math:tanh">tanh</a></td><td class="col1">hyperbolic tangent</td>
	</tr>
</table>

</div>

<h5><a name="compiling_with_gcc" id="compiling_with_gcc">Compiling with gcc</a></h5>
<div class="level5">

<p>

In order to use some of the above functions, certain versions of the gcc compiler require the math library to be explicitly linked in using the <code>-lm</code> command-line option. 
</p>

</div>

    <!-- wikipage stop -->
  </div>

  <div class="clearer">&nbsp;</div>

  
  <div class="stylefoot">

    <div class="meta">
      <div class="user">
              </div>
      <!--
      <div class="doc">
        c/math/start.txt &middot; Last modified: 12/13/2008 06:21 by nate      </div>
      -->
    </div>

   
    <div class="bar" id="bar__bottom">
      <div class="bar-left" id="bar__bottomleft">
        <a href="../../c/math/start.html"  class="action edit" accesskey="e" rel="nofollow">Edit this page</a> &#149;
        <a href="../../c/math/start.html"  class="action revisions" accesskey="o" rel="nofollow">Old revisions</a>      </div>
      <div class="bar-right" id="bar__bottomright">
         &#149;
         &#149;
         &#149;
        <a href="../../c/math/start.html"  class="action login" rel="nofollow">Login</a> &#149;
        <a href="../../c/math/start.html"  class="action index" accesskey="x" rel="nofollow">Index</a> &#149;
        <a href="../../c/math/start.html"  class="action recent" accesskey="r" rel="nofollow">Recent changes</a> &#149;
        <a  href="../../feed.php.html" title="Recent changes RSS feed">RSS</a> &#149;
        <a href='http://creativecommons.org/licenses/by/3.0/us/' title='Creative Commons license'>cc</a> &#149;
        <form action="/wiki/" accept-charset="utf-8" class="search" id="dw__search"><div class="no"><input type="hidden" name="do" value="search" /><input type="text" id="qsearch__in" accesskey="f" name="id" class="edit" title="[ALT+F]" /><input type="submit" value="Search" class="button" title="Search" /><div id="qsearch__out" class="ajax_qsearch JSpopup"></div></div></form>&nbsp;
      </div>
      <div class="clearer"></div>
    </div>

  </div>

</div>

<div class="no"><img src="/wiki/lib/exe/indexer.php?id=c%3Amath%3Astart&amp;1273193078" width="1" height="1" alt=""  /></div>
</body>
</html>