1<html lang="en"> 2<head> 3<title>log - Untitled</title> 4<meta http-equiv="Content-Type" content="text/html"> 5<meta name="description" content="Untitled"> 6<meta name="generator" content="makeinfo 4.13"> 7<link title="Top" rel="start" href="index.html#Top"> 8<link rel="up" href="Math.html#Math" title="Math"> 9<link rel="prev" href="ldexp.html#ldexp" title="ldexp"> 10<link rel="next" href="log10.html#log10" title="log10"> 11<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage"> 12<meta http-equiv="Content-Style-Type" content="text/css"> 13<style type="text/css"><!-- 14 pre.display { font-family:inherit } 15 pre.format { font-family:inherit } 16 pre.smalldisplay { font-family:inherit; font-size:smaller } 17 pre.smallformat { font-family:inherit; font-size:smaller } 18 pre.smallexample { font-size:smaller } 19 pre.smalllisp { font-size:smaller } 20 span.sc { font-variant:small-caps } 21 span.roman { font-family:serif; font-weight:normal; } 22 span.sansserif { font-family:sans-serif; font-weight:normal; } 23--></style> 24<link rel="stylesheet" type="text/css" href="../cs.css"> 25</head> 26<body> 27<div class="node"> 28<a name="log"></a> 29<p> 30Next: <a rel="next" accesskey="n" href="log10.html#log10">log10</a>, 31Previous: <a rel="previous" accesskey="p" href="ldexp.html#ldexp">ldexp</a>, 32Up: <a rel="up" accesskey="u" href="Math.html#Math">Math</a> 33<hr> 34</div> 35 36<h3 class="section">1.33 <code>log</code>, <code>logf</code>—natural logarithms</h3> 37 38<p><a name="index-log-98"></a><a name="index-logf-99"></a><strong>Synopsis</strong> 39<pre class="example"> #include <math.h> 40 double log(double <var>x</var>); 41 float logf(float <var>x</var>); 42 43</pre> 44 <p><strong>Description</strong><br> 45Return the natural logarithm of <var>x</var>, that is, its logarithm base e 46(where e is the base of the natural system of logarithms, 2.71828<small class="dots">...</small>). 47<code>log</code> and <code>logf</code> are identical save for the return and argument types. 48 49 <p>You can use the (non-ANSI) function <code>matherr</code> to specify error 50handling for these functions. 51 52 <p><br> 53<strong>Returns</strong><br> 54Normally, returns the calculated value. When <var>x</var> is zero, the 55returned value is <code>-HUGE_VAL</code> and <code>errno</code> is set to <code>ERANGE</code>. 56When <var>x</var> is negative, the returned value is NaN (not a number) and 57<code>errno</code> is set to <code>EDOM</code>. You can control the error behavior via 58<code>matherr</code>. 59 60 <p><br> 61<strong>Portability</strong><br> 62<code>log</code> is ANSI. <code>logf</code> is an extension. 63 64 <p><br> 65 66 </body></html> 67 68