]>
Commit | Line | Data |
---|---|---|
fea681da | 1 | .\" Copyright 1993 David Metcalfe (david@prism.demon.co.uk) |
a57ce78d MK |
2 | .\" and Copyright 2008, Linux Foundation, written by Michael Kerrisk |
3 | .\" <mtk.manpages@gmail.com> | |
fea681da | 4 | .\" |
5fbde956 | 5 | .\" SPDX-License-Identifier: Linux-man-pages-copyleft |
fea681da MK |
6 | .\" |
7 | .\" References consulted: | |
8 | .\" Linux libc source code | |
9 | .\" Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991) | |
10 | .\" 386BSD man pages | |
11 | .\" Modified 1993-07-24 by Rik Faith (faith@cs.unc.edu) | |
12 | .\" Modified 2004-10-31 by aeb | |
13 | .\" | |
4c1c5274 | 14 | .TH ldexp 3 (date) "Linux man-pages (unreleased)" |
fea681da MK |
15 | .SH NAME |
16 | ldexp, ldexpf, ldexpl \- multiply floating-point number by integral power of 2 | |
6014769d AC |
17 | .SH LIBRARY |
18 | Math library | |
8fc3b2cf | 19 | .RI ( libm ", " \-lm ) |
fea681da MK |
20 | .SH SYNOPSIS |
21 | .nf | |
22 | .B #include <math.h> | |
68e4db0a | 23 | .PP |
fea681da | 24 | .BI "double ldexp(double " x ", int " exp ); |
fea681da | 25 | .BI "float ldexpf(float " x ", int " exp ); |
fea681da MK |
26 | .BI "long double ldexpl(long double " x ", int " exp ); |
27 | .fi | |
68e4db0a | 28 | .PP |
d39ad78f | 29 | .RS -4 |
a57ce78d MK |
30 | Feature Test Macro Requirements for glibc (see |
31 | .BR feature_test_macros (7)): | |
d39ad78f | 32 | .RE |
68e4db0a | 33 | .PP |
a57ce78d MK |
34 | .BR ldexpf (), |
35 | .BR ldexpl (): | |
9d2adbae | 36 | .nf |
5c10d2c5 | 37 | _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L |
9d2adbae MK |
38 | || /* Since glibc 2.19: */ _DEFAULT_SOURCE |
39 | || /* Glibc <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE | |
40 | .fi | |
fea681da | 41 | .SH DESCRIPTION |
5600f73a | 42 | These functions return the result of multiplying the floating-point number |
fea681da MK |
43 | .I x |
44 | by 2 raised to the power | |
45 | .IR exp . | |
a57ce78d MK |
46 | .SH RETURN VALUE |
47 | On success, these functions return | |
48 | .IR "x * (2^exp)" . | |
847e0d88 | 49 | .PP |
a57ce78d MK |
50 | If |
51 | .I exp | |
52 | is zero, then | |
53 | .I x | |
54 | is returned. | |
847e0d88 | 55 | .PP |
a57ce78d MK |
56 | If |
57 | .I x | |
58 | is a NaN, | |
59 | a NaN is returned. | |
847e0d88 | 60 | .PP |
a57ce78d MK |
61 | If |
62 | .I x | |
63 | is positive infinity (negative infinity), | |
64 | positive infinity (negative infinity) is returned. | |
847e0d88 | 65 | .PP |
a57ce78d | 66 | If the result underflows, |
371b557b | 67 | a range error occurs, |
a57ce78d | 68 | and zero is returned. |
847e0d88 | 69 | .PP |
a57ce78d | 70 | If the result overflows, |
efe294cb | 71 | a range error occurs, |
a57ce78d MK |
72 | and the functions return |
73 | .BR HUGE_VAL , | |
74 | .BR HUGE_VALF , | |
75 | or | |
76 | .BR HUGE_VALL , | |
77 | respectively, with a sign the same as | |
78 | .IR x . | |
79 | .SH ERRORS | |
80 | See | |
81 | .BR math_error (7) | |
82 | for information on how to determine whether an error has occurred | |
83 | when calling these functions. | |
84 | .PP | |
85 | The following errors can occur: | |
86 | .TP | |
87 | Range error, overflow | |
88 | .I errno | |
89 | is set to | |
90 | .BR ERANGE . | |
91 | An overflow floating-point exception | |
92 | .RB ( FE_OVERFLOW ) | |
93 | is raised. | |
94 | .TP | |
95 | Range error, underflow | |
96 | .I errno | |
97 | is set to | |
98 | .BR ERANGE . | |
99 | An underflow floating-point exception | |
100 | .RB ( FE_UNDERFLOW ) | |
101 | is raised. | |
742e3682 | 102 | .SH ATTRIBUTES |
23514ee4 MK |
103 | For an explanation of the terms used in this section, see |
104 | .BR attributes (7). | |
c466875e MK |
105 | .ad l |
106 | .nh | |
23514ee4 MK |
107 | .TS |
108 | allbox; | |
c466875e | 109 | lbx lb lb |
23514ee4 MK |
110 | l l l. |
111 | Interface Attribute Value | |
112 | T{ | |
742e3682 PH |
113 | .BR ldexp (), |
114 | .BR ldexpf (), | |
742e3682 | 115 | .BR ldexpl () |
23514ee4 MK |
116 | T} Thread safety MT-Safe |
117 | .TE | |
c466875e MK |
118 | .hy |
119 | .ad | |
120 | .sp 1 | |
3113c7f3 | 121 | .SH STANDARDS |
9a74e018 | 122 | C99, POSIX.1-2001, POSIX.1-2008. |
847e0d88 | 123 | .PP |
a57ce78d MK |
124 | The variant returning |
125 | .I double | |
126 | also conforms to | |
68e1685c | 127 | SVr4, 4.3BSD, C89. |
47297adb | 128 | .SH SEE ALSO |
fea681da MK |
129 | .BR frexp (3), |
130 | .BR modf (3), | |
a57ce78d | 131 | .BR scalbln (3) |