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