ldexp -- Floating-Point Conversion: Load Exponent

SYNOPSIS

 #include <math.h>

 double ldexp (double y, int n);
 

DESCRIPTION

ldexp calculates y(2**n).

RETURN VALUE

ldexp returns the value of type double that results from the calculation.

DIAGNOSTICS

If the return value cannot be represented, a warning message is sent to the standard error file (stderr). +- HUGE_VAL is returned if an overflow occurs; 0 is returned if an underflow occurs.

USAGE NOTES

When used with frexp, the ldexp function is useful in situations that require repeated multiplication by 2. If the next multiplication causes an overflow or underflow, use frexp to separate the mantissa from the exponent. This gives you complete control over the exponent and the mantissa, so you can operate on them separately without any loss of precision. When you are finished, use ldexp to combine the mantissa and exponent again.

RELATED FUNCTIONS

frexp, _ldexp

SEE ALSO

Mathematical Functions

Copyright (c) 1998 SAS Institute Inc. Cary, NC, USA. All rights reserved.