Header File
math.h
Category
Math Routines
Prototype
double ldexp(double x, int exp);
long double ldexpl(long double x, int exp);
Description
Calculates x * 2^exp.
lexpl is the long double version; it takes a long double argument for x and returns a long double result.
Return Value
On success, ldexp (or ldexpl) returns the value it calculated, x * 2^exp. Error handling for these routines can be modified through the functions _matherr and _matherrl.
Example
#include <stdio.h> #include <math.h> int main(void) { double value; double x = 2; /* ldexp raises 2 by a power of 3 then multiplies the result by 2 */ value = ldexp(x,3); printf("The ldexp value is: %lf\n", value); return 0; }
Portability
|
POSIX |
Win32 |
ANSI C |
ANSI C++ |
ldexp |
+ |
+ |
+ |
+ |
ldexpl |
|
+ |
+ |
+ |
Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
|
What do you think about this topic? Send feedback!
|