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():
21 _BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE >= 600 ||
22 _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L;
23 or cc -std=c99
24
26 The ldexp() function returns the result of multiplying the floating-
27 point number x by 2 raised to the power exp.
28
30 On success, these functions return x * (2^exp).
31
32 If exp is zero, then x is returned.
33
34 If x is a NaN, a NaN is returned.
35
36 If x is positive infinity (negative infinity), positive infinity (nega‐
37 tive infinity) is returned.
38
39 If the result underflows, a range error occurs, and zero is returned.
40
41 If the result overflows, a range error occurs, and the functions return
42 HUGE_VAL, HUGE_VALF, or HUGE_VALL, respectively, with a sign the same
43 as x.
44
46 See math_error(7) for information on how to determine whether an error
47 has occurred when calling these functions.
48
49 The following errors can occur:
50
51 Range error, overflow
52 errno is set to ERANGE. An overflow floating-point exception
53 (FE_OVERFLOW) is raised.
54
55 Range error, underflow
56 errno is set to ERANGE. An underflow floating-point exception
57 (FE_UNDERFLOW) is raised.
58
60 C99, POSIX.1-2001. The variant returning double also conforms to SVr4,
61 4.3BSD, C89.
62
64 frexp(3), modf(3), scalbln(3)
65
67 This page is part of release 3.53 of the Linux man-pages project. A
68 description of the project, and information about reporting bugs, can
69 be found at http://www.kernel.org/doc/man-pages/.
70
71
72
73 2010-09-20 LDEXP(3)