log1pd32(), log1pd64(), log1pd128() — Natural log of x+1

Standards

Standards / Extensions C or C++ Dependencies
C/C++ DFP both z/OS® V1.11

Format

#define __STDC_WANT_DEC_FP__
#include <math.h>

_Decimal32  log1pd32(_Decimal32 x); 
_Decimal64  log1pd64(_Decimal64 x); 
_Decimal128 log1pd128(_Decimal128 x); 

_Decimal32  log1p(_Decimal32 x);     /* C++ only */
_Decimal64  log1p(_Decimal64 x);     /* C++ only */
_Decimal128 log1p(_Decimal128 x);    /* C++ only */

General description

Computes
Formula of the functions
The value of x must be greater than -1.0.
Notes:
  1. These functions work in IEEE decimal floating-point format. See IEEE decimal floating-pointIEEE Decimal Floating-Point for more information.
  2. To use IEEE decimal floating-point, the hardware must have the Decimal Floating-Point Facility installed.

Returned value

If successful, log1p() returns the Log (1.0 + x) The value of x must be greater than -1.0.

log1p() will fail under the following conditions:
  • If x is less than -1.0, log1p() will return NaNQ and set errno to EDOM.
  • If x is equal to -1.0, log1p() will return -HUGE_VAL_D32, -HUGE_VAL_D64 or -HUGE_VAL_D128 and errno remains unchanged.

Example

⁄* CELEBL27

   This exaxmple illustrates the log1pd128() function.

*⁄

#define __STDC_WANT_DEC_FP__
#include <math.h>
#include <stdio.h>
void main(void)
{
   _Decimal128 x, y;

   x = 23.2DL;
   y = log1pd128(x);

   printf("log1pd128( %DDf ) = %DDf\n", x , y);
}

Related information