ldexpd32, ldexpd64, and ldexpd128 Subroutines

Purpose

Loads the exponent of a decimal floating-point number.

Syntax

#include <math.h>

_Decimal32 ldexpd32 (x, exp)
_Decimal32 x;
int exp;

_Decimal64 ldexpd64 (x, exp)
_Decimal64 x;
int exp;

_Decimal128 ldexpd128 (x, exp)
_Decimal128 x;
int exp;

Description

The ldexpd32, ldexpd64, and ldexpd128 subroutines compute the quantity x * 10exp.

An application that wants to check for error situations must set the errno global variable to the value of zero and call the feclearexcept(FE_ALL_EXCEPT) before calling these functions. On return, if the errno is of the value of nonzero or the fetestexcept(FE_INVALID | FE_DIVBYZERO | FE_OVERFLOW | FE_UNDERFLOW) is of the value of nonzero, an error has occurred.

Parameters

Item Description
x Specifies the value to be computed.
exp Specifies the exponent of 10.

Return Values

Upon successful completion, the ldexpd32, ldexpd64, and ldexpd128 subroutines return x multiplied by 10 to the power of exp.

If the ldexpd32, ldexpd64, or ldexpd128 subroutines would cause overflow, a range error occurs and the ldexpd32, ldexpd64, and ldexpd128 subroutines return ±HUGE_VAL_D32, ±HUGE_VAL_D64, and ±HUGE_VAL_D128 (according to the sign of x), respectively.

If the correct value will cause underflow, and is not representable, a range error might occur, and 0.0 is returned.

If x is NaN, a NaN is returned.

If x is ±0 or Inf, x is returned.

If exp is 0, x is returned.

If the correct value will cause underflow, and is representable, a range error might occur and the correct value is returned.