Skip to content

Latest commit

 

History

History
89 lines (70 loc) · 2.67 KB

log1p-log1pf-log1pl2.md

File metadata and controls

89 lines (70 loc) · 2.67 KB
title ms.custom ms.date ms.reviewer ms.suite ms.technology ms.tgt_pltfrm ms.topic apiname apilocation apitype f1_keywords helpviewer_keywords ms.assetid caps.latest.revision author ms.author manager
log1p, log1pf, log1pl2 | Microsoft Docs
11/04/2016
cpp
devlang-cpp
article
log1p
log1pf
log1pl
msvcrt.dll
msvcr80.dll
msvcr90.dll
msvcr100.dll
msvcr100_clr0400.dll
msvcr110.dll
msvcr110_clr0400.dll
msvcr120.dll
msvcr120_clr0400.dll
ucrtbase.dll
api-ms-win-crt-math-l1-1-0.dll
DLLExport
log1p
log1pf
log1pl
math/log1p
math/log1pf
math/log1pl
log1p function
log1pf function
log1pl function
a40d965d-b4f6-42f4-ba27-2395546f7c12
7
corob-msft
corob
ghogen

log1p, log1pf, log1pl

Computes the natural logarithm of 1 plus the specified value.

Syntax

double log1p(  
   double x  
);  
  
float log1p(  
   float x  
); //C++ only  
  
long double log1p(  
   long double x  
); //C++ only  
  
float log1pf(  
   float x  
);  
  
long double log1pl(  
   long double x  
);  
  

Parameters

x
The floating-point argument.

Return Value

If successful, returns the natural (base-e) log of (x+1).

Otherwise, may return one of the following values:

Input Result SEH exception errno
+inf +inf
Denormals Same as input UNDERFLOW
±0 Same as input
-1 -inf DIVBYZERO ERANGE
< -1 nan INVALID EDOM
-inf nan INVALID EDOM
±SNaN Same as input INVALID
±QNaN, indefinite Same as input

The errno value is set to ERANGE if x = -1. The errno value is set to EDOM if x < -1.

Remarks

The log1p functions may be more accurate than using log(x+1) when x is near 0.

Because C++ allows overloading, you can call overloads of log1p that take and return float and long double types. In a C program, log1p always takes and returns a double.

If x is a natural number, this function returns the logarithm of the factorial of (x-1).

Requirements

Function C header C++ header
log1p, log1pf, log1pl <math.h> <cmath>

For additional compatibility information, see Compatibility.

See Also

Alphabetical Function Reference
log2, log2f, log2l
log, logf, log10, log10f