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 _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L
22 || /* Since glibc 2.19: */ _DEFAULT_SOURCE
23 || /* Glibc versions <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE
24
26 These functions return the result of multiplying the floating-point
27 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 For an explanation of the terms used in this section, see
61 attributes(7).
62
63 ┌────────────────────────────┬───────────────┬─────────┐
64 │Interface │ Attribute │ Value │
65 ├────────────────────────────┼───────────────┼─────────┤
66 │ldexp(), ldexpf(), ldexpl() │ Thread safety │ MT-Safe │
67 └────────────────────────────┴───────────────┴─────────┘
69 C99, POSIX.1-2001, POSIX.1-2008.
70
71 The variant returning double also conforms to SVr4, 4.3BSD, C89.
72
74 frexp(3), modf(3), scalbln(3)
75
77 This page is part of release 4.15 of the Linux man-pages project. A
78 description of the project, information about reporting bugs, and the
79 latest version of this page, can be found at
80 https://www.kernel.org/doc/man-pages/.
81
82
83
84 2017-09-15 LDEXP(3)