scalbnd32(), scalbnd64(), scalbnd128() and scalblnd32(), scalblnd64(), scalblnd128() — Load exponent functions

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  scalbnd32(_Decimal32 x, int n); 
_Decimal64  scalbnd64(_Decimal64 x, int n);
_Decimal128 scalbnd128(_Decimal128 x, int n);
_Decimal32  scalbn(_Decimal32 x, int n);    /* C++ only */
_Decimal64  scalbn(_Decimal64 x, int n);    /* C++ only */
_Decimal128 scalbn(_Decimal128 x, int n);   /* C++ only */

_Decimal32  scalblnd32(_Decimal32 x, long int n); 
_Decimal64  scalblnd64(_Decimal64 x, long int n);
_Decimal128 scalblnd128(_Decimal128 x, long int n);
_Decimal32  scalbln(_Decimal32 x, long int n);    /* C++ only */
_Decimal64  scalbln(_Decimal64 x, long int n);    /* C++ only */
_Decimal128 scalbln(_Decimal128 x, long int n)    /* C++ only */

General description

The scalbn() and scalbln() families of functions compute (x * 10 raised to n) efficiently, not normally, by computing 10 raised to n explicitly.

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

The scalbn() and scalbln() families of functions return (x * 10 raised to n).

Example

⁄* CELEBS68

   This example illustrates the scalbnd128() function.

*⁄

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

int main(void)
{
   _Decimal128 x, y;

   x = 7.2DL;
   y = scalbnd128(x, 6000);

   printf("scalbnd128(%DDf, 6000) = %DDe\n", x, y);
}

Related information