Computes the exponent using FLT_RADIX=2.
#include <math.h>
double scalbln (x, n)
double x;
long n;
float scalblnf (x, n)
float x;
long n;
long double scalblnl (x, n)
long double x;
long n;
double scalbn (x, n)
double x;
int n;
float scalbnf (x, n)
float x;
int n;
long double scalbnl (x, n)
long double x;
int n;
double scalb(x, y)
double x, y;
The scalbln, scalblnf, scalblnl, scalbn, scalbnf, and scalbnl subroutines compute x * FLT_RADIXn efficiently, not normally by computing FLT_RADIXn explicitly. For AIX®, FLT_RADIX n=2.
The scalb subroutine returns the value of the x parameter times 2 to the power of the y parameter.
An application wishing to check for error situations should set the errno global variable to zero and call feclearexcept(FE_ALL_EXCEPT) before calling these subroutines. Upon return, if errno is nonzero or fetestexcept(FE_INVALID | FE_DIVBYZERO | FE_OVERFLOW | FE_UNDERFLOW) is nonzero, an error has occurred.
Item | Description |
---|---|
x | Specifies the value to be computed. |
n | Specifies the value to be computed. |
Upon successful completion, the scalbln, scalblnf, scalblnl, scalbn, scalbnf, and scalbnl subroutines return x * FLT_RADIXn .
If the result would cause overflow, a range error occurs and the scalbln, scalblnf, scalblnl, scalbn, scalbnf, and scalbnl subroutines return ±HUGE_VAL, ±HUGE_VALF, and ±HUGE_VALL (according to the sign of x) as appropriate for the return type of the function.
If the correct value would cause underflow, and is not representable, a range error may occur, and 0.0 is returned.
If x is NaN, a NaN is returned.
If x is ±0 or ±Inf, x is returned.
If n is 0, x is returned.
If the correct value would cause underflow, and is representable, a range error may occur and the correct value is returned.
If the correct value would overflow, the scalb subroutine returns +/-INF (depending on a negative or positive value of the x parameter) and sets errno to ERANGE.
If the correct value would underflow, the scalb subroutine returns a value of 0 and sets errno to ERANGE.