]> git.ipfire.org Git - thirdparty/man-pages.git/blob - man3/scalb.3
22cab303a2831dc13b440fe132262113a3ea0c5b
[thirdparty/man-pages.git] / man3 / scalb.3
1 '\" t
2 .\" Copyright 2004 Andries Brouwer <aeb@cwi.nl>.
3 .\" and Copyright 2008, Linux Foundation, written by Michael Kerrisk
4 .\" <mtk.manpages@gmail.com>
5 .\"
6 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
7 .\"
8 .TH scalb 3 (date) "Linux man-pages (unreleased)"
9 .SH NAME
10 scalb, scalbf, scalbl \- multiply floating-point number
11 by integral power of radix (OBSOLETE)
12 .SH LIBRARY
13 Math library
14 .RI ( libm ", " \-lm )
15 .SH SYNOPSIS
16 .nf
17 .B #include <math.h>
18 .PP
19 .BI "[[deprecated]] double scalb(double " x ", double " exp );
20 .BI "[[deprecated]] float scalbf(float " x ", float " exp );
21 .BI "[[deprecated]] long double scalbl(long double " x ", long double " exp );
22 .fi
23 .PP
24 .RS -4
25 Feature Test Macro Requirements for glibc (see
26 .BR feature_test_macros (7)):
27 .RE
28 .PP
29 .BR scalb ():
30 .nf
31 _XOPEN_SOURCE >= 500
32 .\" || _XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED
33 || /* Since glibc 2.19: */ _DEFAULT_SOURCE
34 || /* glibc <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE
35 .fi
36 .PP
37 .BR scalbf (),
38 .BR scalbl ():
39 .nf
40 _XOPEN_SOURCE >= 600
41 || /* Since glibc 2.19: */ _DEFAULT_SOURCE
42 || /* glibc <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE
43 .fi
44 .SH DESCRIPTION
45 These functions multiply their first argument
46 .I x
47 by
48 .B FLT_RADIX
49 (probably 2)
50 to the power of
51 .IR exp ,
52 that is:
53 .PP
54 .nf
55 x * FLT_RADIX ** exp
56 .fi
57 .PP
58 The definition of
59 .B FLT_RADIX
60 can be obtained by including
61 .IR <float.h> .
62 .\" not in /usr/include but in a gcc lib
63 .SH RETURN VALUE
64 On success, these functions return
65 .I x
66 *
67 .B FLT_RADIX
68 **
69 .IR exp .
70 .PP
71 If
72 .I x
73 or
74 .I exp
75 is a NaN, a NaN is returned.
76 .PP
77 If
78 .I x
79 is positive infinity (negative infinity),
80 and
81 .I exp
82 is not negative infinity,
83 positive infinity (negative infinity) is returned.
84 .PP
85 If
86 .I x
87 is +0 (\-0), and
88 .I exp
89 is not positive infinity, +0 (\-0) is returned.
90 .PP
91 If
92 .I x
93 is zero, and
94 .I exp
95 is positive infinity,
96 a domain error occurs, and
97 a NaN is returned.
98 .PP
99 If
100 .I x
101 is an infinity,
102 and
103 .I exp
104 is negative infinity,
105 a domain error occurs, and
106 a NaN is returned.
107 .PP
108 If the result overflows,
109 a range error occurs,
110 and the functions return
111 .BR HUGE_VAL ,
112 .BR HUGE_VALF ,
113 or
114 .BR HUGE_VALL ,
115 respectively, with a sign the same as
116 .IR x .
117 .PP
118 If the result underflows,
119 a range error occurs,
120 and the functions return zero, with a sign the same as
121 .IR x .
122 .SH ERRORS
123 See
124 .BR math_error (7)
125 for information on how to determine whether an error has occurred
126 when calling these functions.
127 .PP
128 The following errors can occur:
129 .TP
130 Domain error: \fIx\fP is 0, and \fIexp\fP is positive infinity, \
131 or \fIx\fP is positive infinity and \fIexp\fP is negative infinity \
132 and the other argument is not a NaN
133 .I errno
134 is set to
135 .BR EDOM .
136 An invalid floating-point exception
137 .RB ( FE_INVALID )
138 is raised.
139 .TP
140 Range error, overflow
141 .I errno
142 is set to
143 .BR ERANGE .
144 An overflow floating-point exception
145 .RB ( FE_OVERFLOW )
146 is raised.
147 .TP
148 Range error, underflow
149 .I errno
150 is set to
151 .BR ERANGE .
152 An underflow floating-point exception
153 .RB ( FE_UNDERFLOW )
154 is raised.
155 .SH ATTRIBUTES
156 For an explanation of the terms used in this section, see
157 .BR attributes (7).
158 .ad l
159 .nh
160 .TS
161 allbox;
162 lbx lb lb
163 l l l.
164 Interface Attribute Value
165 T{
166 .BR scalb (),
167 .BR scalbf (),
168 .BR scalbl ()
169 T} Thread safety MT-Safe
170 .TE
171 .hy
172 .ad
173 .sp 1
174 .SH STANDARDS
175 None.
176 .SH HISTORY
177 .TP
178 .BR scalb ()
179 4.3BSD.
180 Obsolescent in POSIX.1-2001;
181 Removed in POSIX.1-2008,
182 recommending the use of
183 .BR scalbln (3),
184 .BR scalblnf (3),
185 or
186 .BR scalblnl (3)
187 instead.
188 .\" Looking at header files: scalbf() is present on the
189 .\" BSDs, Tru64, HP-UX 11, Irix 6.5; scalbl() is on HP-UX 11 and Tru64.
190 .SH BUGS
191 Before glibc 2.20,
192 .\" https://www.sourceware.org/bugzilla/show_bug.cgi?id=6803
193 .\" https://www.sourceware.org/bugzilla/show_bug.cgi?id=6804
194 these functions did not set
195 .I errno
196 for domain and range errors.
197 .SH SEE ALSO
198 .BR ldexp (3),
199 .BR scalbln (3)