Chapter Contents

Previous

Next
ldexp

ldexp



Floating-Point Conversion: Load Exponent

Portability: ISO/ANSI C conforming, UNIX compatible


SYNOPSIS
DESCRIPTION
RETURN VALUE
DIAGNOSTICS
USAGE NOTES
RELATED FUNCTIONS
SEE ALSO


SYNOPSIS

#include <math.h>

double ldexp (double y, int i);


DESCRIPTION

ldexp calculates y * 2i.


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


Chapter Contents

Previous

Next

Top of Page

Copyright © 2001 by SAS Institute Inc., Cary, NC, USA. All rights reserved.