ldexp [ HP C/iX Library Reference Manual ] MPE/iX 5.0 Documentation
HP C/iX Library Reference Manual
ldexp
Accepts a double value and an integer exponent exp, and returns a double
quantity equal to value * 2exp.
Syntax
#include <math.h>
double ldexp (double value, int exp);
Parameters
value A real number that is to be multiplied by 2exp.
exp The integer exponent value to which 2 is raised.
Return Values
n The result of value * 2exp.
0 An underflow condition has occurred; errno is set to
indicate the error.
HUGE_VAL An overflow condition has occurred.
Description
The ldexp function multiplies the floating-point argument value by an
integral power of 2exp.
Example
The following program accepts two number arguments, value and exp, and
outputs the result:
main(argc, argv)
int argc;
char *argv[ ];
{
double value, result, ldexp();
int exp;
sscanf(argv[1], "%lf", &value);
sscanf(argv[2], "%d", &exp);
result = ldexp(value, exp);
printf("%g * 2^%d = %g\n", value, exp, result);
}
See Also
ANSI C 4.5.4.3, POSIX.1 8.1
MPE/iX 5.0 Documentation