Debian Codegraph @

upstream/debian-trixie/man3/scalbln.3

raw
1 '\" t
2 .\" Copyright 2004 Andries Brouwer <[email protected]>.
3 .\" and Copyright 2008, Linux Foundation, written by Michael Kerrisk
4 .\" <[email protected]>
5 .\"
6 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
7 .\"
8 .TH scalbln 3 2024-05-02 "Linux man-pages 6.9.1"
9 .SH NAME
10 scalbn, scalbnf, scalbnl, scalbln, scalblnf, scalblnl \-
11 multiply floating-point number by integral power of radix
12 .SH LIBRARY
13 Math library
14 .RI ( libm ", " \-lm )
15 .SH SYNOPSIS
16 .nf
17 .B #include <math.h>
18 .P
19 .BI "double scalbln(double " x ", long " exp );
20 .BI "float scalblnf(float " x ", long " exp );
21 .BI "long double scalblnl(long double " x ", long " exp );
22 .P
23 .BI "double scalbn(double " x ", int " exp );
24 .BI "float scalbnf(float " x ", int " exp );
25 .BI "long double scalbnl(long double " x ", int " exp );
26 .fi
27 .P
28 .RS -4
29 Feature Test Macro Requirements for glibc (see
30 .BR feature_test_macros (7)):
31 .RE
32 .P
33 .BR scalbln (),
34 .BR scalblnf (),
35 .BR scalblnl ():
36 .nf
37 _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L
38 || /* Since glibc 2.19: */ _DEFAULT_SOURCE
39 .fi
40 .P
41 .BR scalbn (),
42 .BR scalbnf (),
43 .BR scalbnl ():
44 .nf
45 _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L
46 || /* Since glibc 2.19: */ _DEFAULT_SOURCE
47 || /* glibc <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE
48 .fi
49 .SH DESCRIPTION
50 These functions multiply their first argument
51 .I x
52 by
53 .B FLT_RADIX
54 (probably 2)
55 to the power of
56 .IR exp ,
57 that is:
58 .P
59 .nf
60 x * FLT_RADIX ** exp
61 .fi
62 .P
63 The definition of
64 .B FLT_RADIX
65 can be obtained by including
66 .IR <float.h> .
67 .\" not in /usr/include but in a gcc lib
68 .SH RETURN VALUE
69 On success, these functions return
70 .I x
71 *
72 .B FLT_RADIX
73 **
74 .IR exp .
75 .P
76 If
77 .I x
78 is a NaN, a NaN is returned.
79 .P
80 If
81 .I x
82 is positive infinity (negative infinity),
83 positive infinity (negative infinity) is returned.
84 .P
85 If
86 .I x
87 is +0 (\-0), +0 (\-0) is returned.
88 .P
89 If the result overflows,
90 a range error occurs,
91 and the functions return
92 .BR HUGE_VAL ,
93 .BR HUGE_VALF ,
94 or
95 .BR HUGE_VALL ,
96 respectively, with a sign the same as
97 .IR x .
98 .P
99 If the result underflows,
100 a range error occurs,
101 and the functions return zero, with a sign the same as
102 .IR x .
103 .SH ERRORS
104 See
105 .BR math_error (7)
106 for information on how to determine whether an error has occurred
107 when calling these functions.
108 .P
109 The following errors can occur:
110 .TP
111 Range error, overflow
112 .\" .I errno
113 .\" is set to
114 .\" .BR ERANGE .
115 An overflow floating-point exception
116 .RB ( FE_OVERFLOW )
117 is raised.
118 .TP
119 Range error, underflow
120 .I errno
121 is set to
122 .BR ERANGE .
123 An underflow floating-point exception
124 .RB ( FE_UNDERFLOW )
125 is raised.
126 .SH ATTRIBUTES
127 For an explanation of the terms used in this section, see
128 .BR attributes (7).
129 .TS
130 allbox;
131 lbx lb lb
132 l l l.
133 Interface Attribute Value
134 T{
135 .na
136 .nh
137 .BR scalbn (),
138 .BR scalbnf (),
139 .BR scalbnl (),
140 .BR scalbln (),
141 .BR scalblnf (),
142 .BR scalblnl ()
143 T} Thread safety MT-Safe
144 .TE
145 .SH STANDARDS
146 C11, POSIX.1-2008.
147 .SH HISTORY
148 glibc 2.1.
149 C99, POSIX.1-2001.
150 .SH HISTORY
151 These functions differ from the obsolete functions described in
152 .BR scalb (3)
153 in the type of their second argument.
154 The functions described on this page have a second argument
155 of an integral type, while those in
156 .BR scalb (3)
157 have a second argument of type
158 .IR double .
159 .SH NOTES
160 If
161 .B FLT_RADIX
162 equals 2 (which is usual), then
163 .BR scalbn ()
164 is equivalent to
165 .BR ldexp (3).
166 .SH BUGS
167 Before glibc 2.20,
168 .\" https://www.sourceware.org/bugzilla/show_bug.cgi?id=6803
169 these functions did not set
170 .I errno
171 for range errors.
172 .SH SEE ALSO
173 .BR ldexp (3),
174 .BR scalb (3)