Debian Codegraph @

upstream/debian-unstable/man3/ldexp.3

raw
1 '\" t
2 .\" Copyright 1993, David Metcalfe <[email protected]>
3 .\" Copyright, the authors of the Linux man-pages project
4 .\"
5 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
6 .\"
7 .TH ldexp 3 2026-02-08 "Linux man-pages 6.18"
8 .SH NAME
9 ldexp, ldexpf, ldexpl \- multiply floating-point number by integral power of 2
10 .SH LIBRARY
11 Math library
12 .RI ( libm ,\~ \-lm )
13 .SH SYNOPSIS
14 .nf
15 .B #include <math.h>
16 .P
17 .BI "double ldexp(double " x ", int " e );
18 .BI "float ldexpf(float " x ", int " e );
19 .BI "long double ldexpl(long double " x ", int " e );
20 .fi
21 .P
22 .RS -4
23 Feature Test Macro Requirements for glibc (see
24 .BR feature_test_macros (7)):
25 .RE
26 .P
27 .BR ldexpf (),
28 .BR ldexpl ():
29 .nf
30 _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L
31 || /* Since glibc 2.19: */ _DEFAULT_SOURCE
32 || /* glibc <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE
33 .fi
34 .SH DESCRIPTION
35 These functions return the result of multiplying the floating-point number
36 .I x
37 by 2 raised to the power
38 .IR e .
39 .SH RETURN VALUE
40 On success, these functions return
41 .IR "x * (2\[ha]e)" .
42 .P
43 If
44 .I e
45 is zero, then
46 .I x
47 is returned.
48 .P
49 If
50 .I x
51 is a NaN,
52 a NaN is returned.
53 .P
54 If
55 .I x
56 is positive infinity (negative infinity),
57 positive infinity (negative infinity) is returned.
58 .P
59 If the result underflows,
60 a range error occurs,
61 and zero is returned.
62 .P
63 If the result overflows,
64 a range error occurs,
65 and the functions return
66 .BR HUGE_VAL ,
67 .BR HUGE_VALF ,
68 or
69 .BR HUGE_VALL ,
70 respectively, with a sign the same as
71 .IR x .
72 .SH ERRORS
73 See
74 .BR math_error (7)
75 for information on how to determine whether an error has occurred
76 when calling these functions.
77 .P
78 The following errors can occur:
79 .TP
80 Range error, overflow
81 .I errno
82 is set to
83 .BR ERANGE .
84 An overflow floating-point exception
85 .RB ( FE_OVERFLOW )
86 is raised.
87 .TP
88 Range error, underflow
89 .I errno
90 is set to
91 .BR ERANGE .
92 An underflow floating-point exception
93 .RB ( FE_UNDERFLOW )
94 is raised.
95 .SH ATTRIBUTES
96 For an explanation of the terms used in this section, see
97 .BR attributes (7).
98 .TS
99 allbox;
100 lbx lb lb
101 l l l.
102 Interface Attribute Value
103 T{
104 .na
105 .nh
106 .BR ldexp (),
107 .BR ldexpf (),
108 .BR ldexpl ()
109 T} Thread safety MT-Safe
110 .TE
111 .SH STANDARDS
112 C11, POSIX.1-2008.
113 .SH HISTORY
114 C99, POSIX.1-2001.
115 .P
116 The variant returning
117 .I double
118 also conforms to
119 SVr4, 4.3BSD, C89.
120 .SH SEE ALSO
121 .BR frexp (3),
122 .BR modf (3),
123 .BR scalbln (3)