6.11.165 scalbnl Function
Calculates the signed exponent of a long double precision floating-point value.
Include
<math.h>
Prototype
long double scalbnl(long double x, int n);
Argument
x
- multiplier
n
- the power to which
FLT_RADIX
is raised
Return Value
Efficiently calculates and returns the value of x
times
FLT_RADIX
n
.
Example
See the notes at the beginning of this chapter or section for
information on using printf()
or scanf()
(and other functions reading and writing the stdin
or
stdout
streams) in the example code.
#include <math.h>
#include <stdio.h>
#include <errno.h>
int main(void)
{
long double x, y;
int power;
errno = 0;
x = 13.45;
power = 8;
y = scalbnl(x, power);
if (errno)
perror("Error");
printf("FLT_RADIX raised to the power %d, times %Lf is %Lf\n", power, x, y);
}
Example Output
FLT_RADIX raised to the power 8, times 13.450000 is 3443.200000