log10d32(), log10d64(), log10d128() — Calculate base 10 logarithm

Standards

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

Format

#define __STDC_WANT_DEC_FP__
#include <math.h>

_Decimal32  log10d32(_Decimal32 x); 
_Decimal64  log10d64(_Decimal64 x);
_Decimal128 log10d128(_Decimal128 x);

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

General description

Calculates the base 10 logarithm of the positive value of x.
Notes:
  1. To use IEEE decimal floating-point, the hardware must have the Decimal Floating-Point Facility installed.
  2. These functions work in IEEE decimal floating-point format. See "IEEE Decimal Floating-Point" for more information.

Returned value

If successful, the function returns the base 10 logarithm of the positive value of x.

If x is negative, the function sets errno to EDOM and returns NaNQ.

If x is 0, the function returns -HUGE_VAL_D32, -HUGE_VAL_D64, or -HUGE_VAL_D128 and errno remains unchanged.

Example

⁄* CELEBL23

   This example illustrates the log10d128() function.

*⁄

#define  __STDC_WANT_DEC_FP__
#include <math.h>
#include <stdio.h>

int main(void)
{
   _Decimal128 x = 1000.0DL, y;

   y = log10d128(x);

   printf("The base 10 logarithm of %DDf is %DDf\n", x, y);
}

Related information