Standards
Standards / Extensions |
C or C++ |
Dependencies |
XPG4.2
Single UNIX Specification, Version 3
|
both |
|
Format
#define _XOPEN_SOURCE_EXTENDED 1
#include <math.h>
double scalb(double x, double n);
General description
The scalb()
function computes
.
If
n is not an integer,
it is silently truncated.
Note: This function works in both IEEE
Binary Floating-Point and hexadecimal floating-point formats. The
radix is
16 for hexadecimal floating-point and 2 for IEEE Binary Floating-Point.
See
IEEE binary floating-point for more information
about IEEE Binary Floating-Point.
Returned value
If it succeeds, scalb() returns
the function of its arguments as described above.
scalb() will
fail under the following conditions:
- If the result would underflow, scalb() will return 0 and set errno
to ERANGE.
- If the result would overflow, scalb() will return ±HUGE_VAL according
to the sign of x and set errno to ERANGE.
Special
behavior for IEEE: If successful, scalb() returns the value of
the x parameter times 2 to the power of
the y parameter.
If the result would
overflow, scalb() returns ±HUGE_VAL according to the sign of x and
sets errno to ERANGE. No other errors can occur.