Namespaces
Variants
Views
Actions

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

From cppreference.com
< cpp‎ | numeric‎ | math
m (Shorten template names. Use {{lc}} where appropriate.)
Line 1: Line 1:
 
{{cpp/title|log1p}}
 
{{cpp/title|log1p}}
 
{{cpp/numeric/math/navbar}}
 
{{cpp/numeric/math/navbar}}
{{ddcl list begin}}
+
{{dcl begin}}
{{ddcl list header | cmath}}
+
{{dcl header | cmath}}
{{ddcl list item |notes={{mark since c++11}}|
+
{{dcl |notes={{mark since c++11}}|
 
float      log1p( float arg );
 
float      log1p( float arg );
 
}}
 
}}
{{ddcl list item |notes={{mark since c++11}}|
+
{{dcl |notes={{mark since c++11}}|
 
double      log1p( double arg );
 
double      log1p( double arg );
 
}}
 
}}
{{ddcl list item |notes={{mark since c++11}}|
+
{{dcl |notes={{mark since c++11}}|
 
long double log1p( long double arg );
 
long double log1p( long double arg );
 
}}
 
}}
{{ddcl list item |notes={{mark since c++11}}|
+
{{dcl |notes={{mark since c++11}}|
 
double      log1p( Integral arg );
 
double      log1p( Integral arg );
 
}}
 
}}
{{ddcl list end}}
+
{{dcl end}}
  
 
Computes the natural (base {{c|e}}) logarithm of {{c|1+arg}}. This function is more precise than the expression {{c|std::log(1+arg)}} if {{tt|arg}} is close to zero.
 
Computes the natural (base {{c|e}}) logarithm of {{c|1+arg}}. This function is more precise than the expression {{c|std::log(1+arg)}} if {{tt|arg}} is close to zero.
  
 
===Parameters===
 
===Parameters===
{{param list begin}}
+
{{par begin}}
{{param list item | arg | floating point value}}
+
{{par | arg | floating point value}}
{{param list end}}
+
{{par end}}
  
 
===Return value===
 
===Return value===
Line 28: Line 28:
 
{{math|ln(1+arg)}}
 
{{math|ln(1+arg)}}
  
Domain error occurs if {{tt|arg}} is less than {{c|-1}}. {{c|NAN}} is returned in that case.
+
Domain error occurs if {{tt|arg}} is less than {{c|-1}}. {{lc|NAN}} is returned in that case.
  
 
Range error occurs if {{tt|arg}} is {{c|-1}}. {{c|-HUGE_VAL}} is returned in that case.  
 
Range error occurs if {{tt|arg}} is {{c|-1}}. {{c|-HUGE_VAL}} is returned in that case.  
Line 34: Line 34:
 
===See also===
 
===See also===
  
{{dcl list begin}}
+
{{dsc begin}}
{{dcl list template | cpp/numeric/math/dcl list log}}
+
{{dsc inc | cpp/numeric/math/dcl list log}}
{{dcl list template | cpp/numeric/math/dcl list expm1}}
+
{{dsc inc | cpp/numeric/math/dcl list expm1}}
{{dcl list template | cpp/numeric/math/dcl list log10}}
+
{{dsc inc | cpp/numeric/math/dcl list log10}}
{{dcl list template | cpp/numeric/math/dcl list log2}}
+
{{dsc inc | cpp/numeric/math/dcl list log2}}
{{dcl list end}}
+
{{dsc end}}
  
 
[[de:cpp/numeric/math/log1p]]
 
[[de:cpp/numeric/math/log1p]]

Revision as of 19:20, 31 May 2013

 
 
 
 
Defined in header <cmath>
float       log1p( float arg );
(since C++11)
double      log1p( double arg );
(since C++11)
long double log1p( long double arg );
(since C++11)
double      log1p( Integral arg );
(since C++11)

Computes the natural (base e) logarithm of 1+arg. This function is more precise than the expression std::log(1+arg) if arg is close to zero.

Parameters

arg - floating point value

Return value

ln(1+arg)

Domain error occurs if arg is less than -1. NAN is returned in that case.

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

See also

Template:cpp/numeric/math/dcl list logTemplate:cpp/numeric/math/dcl list expm1Template:cpp/numeric/math/dcl list log10Template:cpp/numeric/math/dcl list log2