Namespaces
Variants
Views
Actions

Difference between revisions of "cpp/numeric/math/log2"

From cppreference.com
< cpp‎ | numeric‎ | math
m (stray parenthesis)
m (Text replace - "{{cpp|" to "{{c|")
Line 17: Line 17:
 
{{ddcl list end}}
 
{{ddcl list end}}
  
Computes the base {{cpp|2}} logarithm of {{cpp|arg}}.
+
Computes the base {{c|2}} logarithm of {{c|arg}}.
  
 
===Parameters===
 
===Parameters===
Line 28: Line 28:
 
{{math|log{{su|b=2}}(arg)}}
 
{{math|log{{su|b=2}}(arg)}}
  
Domain error occurs if {{tt|arg}} is negative. {{cpp|NAN}} is returned in that case.
+
Domain error occurs if {{tt|arg}} is negative. {{c|NAN}} is returned in that case.
  
Range error occurs if {{tt|arg}} is {{cpp|0}}. {{cpp|-HUGE_VAL}} is returned in that case.  
+
Range error occurs if {{tt|arg}} is {{c|0}}. {{c|-HUGE_VAL}} is returned in that case.  
  
 
===See also===
 
===See also===

Revision as of 16:03, 19 April 2012

Template:cpp/numeric/math/sidebar Template:ddcl list begin <tr class="t-dsc-header">

<td>
Defined in header <cmath>
</td>

<td></td> <td></td> </tr> <tr class="t-dcl ">

<td >
float       log2( float arg );
</td>

<td class="t-dcl-nopad"> </td> <td > (since C++11) </td> </tr> <tr class="t-dcl ">

<td >
double      log2( double arg );
</td>

<td class="t-dcl-nopad"> </td> <td > (since C++11) </td> </tr> <tr class="t-dcl ">

<td >
long double log2( long double arg );
</td>

<td class="t-dcl-nopad"> </td> <td > (since C++11) </td> </tr> <tr class="t-dcl ">

<td >
double      log2( Integral arg );
</td>

<td class="t-dcl-nopad"> </td> <td > (since C++11) </td> </tr> Template:ddcl list end

Computes the base 2 logarithm of arg.

Parameters

arg - floating point value

Return value

log2(arg)

Domain error occurs if arg is negative. NAN is returned in that case.

Range error occurs if arg is 0. -HUGE_VAL is returned in that case.

See also

Template:cpp/numeric/math/dcl list logTemplate:cpp/numeric/math/dcl list log10