quantexpd32() - quantexpd64() - quantexpd128() — Compute the Quantum Exponent

Format

#define __STDC_WANT_DEC_FP__
#include <math.h>
int quantexpd32(_Decimal32 x); 
int quantexpd64(_Decimal64 x); 
int quantexpd128(_Decimal128 x); 

Language Level

ANSI

Threadsafe

Yes

Description

The quantexpd32(), quantexpd64(), and quantexpd128() functions compute the quantum exponent of a finite argument. The numerical value of a finite number is given by: (-1)sign x coefficient x 10exponent. The quantum of a finite number is given by 1 x 10exponent and represents the value of a unit in the least significant position of the coefficient of a finite number. The quantum exponent is the exponent of the quantum (represented by exponent above).

Return Value

The quantexpd32(), quantexpd64(), and quantexpd128() functions return the quantum exponent of x. If x is infinite or NaN, errno is set to EDOM and the value INT_MIN is returned.

Example

This example illustrates the use of the quantexpd128() function:
#define __STDC_WANT_DEC_FP__
#include <stdio.h> 
#include <math.h>
int main(void)
{
   _Decimal128 x;
   int y;

   x = 4.56DL;
   y = quantexpd128(x);
   printf("quantexpd128(%DDa) = %d\n", x, y);

   return 0;
} 

/***************** Output should be similar to: ***************** 
quantexpd128(4.56) = -2
*/

Related Information