[ First ]  [ Previous ]  [ Next ]  [ Last ]  [ Manuals ]


ldexp

Compute a value from a mantissa and exponent.

Compatibility:

This function is compatible with the following targets:

ANSI

BeOS

EMB/RTOS

Mac OS

Palm OS

Win32


Prototype:
#include <math.h>

double ldexp(double x, int exp);
float ldexpf(float, int);
long double ldexpl(long double, int);
Parameters:

Parameters for this function are:

x  
double, float or long double  
The value to compute  
exp  
int  
Exponent  

Remarks:

The ldexp() function computes x *2exp. This function can be used to construct a double value from the values returned by the frexp() function.

Return:

ldexp() returns x * 2exp.

See Also:

"frexp"

"modf"

Example of Idexp() usage.:
#include <math.h>
#include <stdio.h>

int main(void)
{
	double value, x = 0.75;
	int e = 4;
	
	value = ldexp(x, e);

	printf("%f * 2 to the power of %d is %f.\n",x, e, value);

	return 0;
}

Output:
0.750000 * 2 to the power of 4 is 12.000000.


[ First ]  [ Previous ]  [ Next ]  [ Last ]  [ Manuals ]

Visit the Metrowerks website at: http://www.metrowerks.com
For assistance contact Metrowerks Technical Support at: cw_support@metrowerks.com
Copyright © 2000, Metrowerks Corp. All rights reserved.

Last updated: August 16, 2000