1LDEXP(3) Linux Programmer's Manual LDEXP(3)
2
3
4
6 ldexp, ldexpf, ldexpl - multiply floating-point number by integral
7 power of 2
8
10 #include <math.h>
11
12 double ldexp(double x, int exp);
13 float ldexpf(float x, int exp);
14 long double ldexpl(long double x, int exp);
15
16 Link with -lm.
17
18 Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
19
20 ldexpf(), ldexpl(): _BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE >= 600
21 || _ISOC99_SOURCE; or cc -std=c99
22
24 The ldexp() function returns the result of multiplying the floating-
25 point number x by 2 raised to the power exp.
26
28 On success, these functions return x * (2^exp).
29
30 If exp is zero, then x is returned.
31
32 If x is a NaN, a NaN is returned.
33
34 If x is positive infinity (negative infinity), positive infinity (nega‐
35 tive infinity) is returned.
36
37 If the result underflows, an range error occurs, and zero is returned.
38
39 If the result overflows, a range error occurs, and the functions return
40 HUGE_VAL, HUGE_VALF, or HUGE_VALL, respectively, with a sign the same
41 as x.
42
44 See math_error(7) for information on how to determine whether an error
45 has occurred when calling these functions.
46
47 The following errors can occur:
48
49 Range error, overflow
50 errno is set to ERANGE. An overflow floating-point exception
51 (FE_OVERFLOW) is raised.
52
53 Range error, underflow
54 errno is set to ERANGE. An underflow floating-point exception
55 (FE_UNDERFLOW) is raised.
56
58 C99, POSIX.1-2001. The variant returning double also conforms to SVr4,
59 4.3BSD, C89.
60
62 frexp(3), modf(3), scalbln(3)
63
65 This page is part of release 3.22 of the Linux man-pages project. A
66 description of the project, and information about reporting bugs, can
67 be found at http://www.kernel.org/doc/man-pages/.
68
69
70
71 2008-08-05 LDEXP(3)