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


frexp

Extract the 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 frexp(double value, int *exp);
float frexpf(float, int *);
long double frexpl(long double, int *);
Parameters:

Parameters for this function are:

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

Remarks:

The frexp() function extracts the mantissa and exponent of value based on the formula x*2n, where the mantissa is 0.5 £ |x| < 1.0 and n is an integer exponent.

Return:

frexp() returns the double mantissa of value. It stores the integer exponent value at the address referenced by exp.

See Also:

"ldexp"

"fmod"

frexp() example:
#include <math.h>
#include <stdio.h>

int main(void)
{
	double m, value = 12.0;
	int e;

	m = frexp(value, &e);

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

	return 0;
}

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


[ 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