]> git.ipfire.org Git - thirdparty/man-pages.git/blob - man3/scalb.3
dlinfo.3: ATTRIBUTES: Note function that is thread-safe
[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 .\" %%%LICENSE_START(VERBATIM)
6 .\" Permission is granted to make and distribute verbatim copies of this
7 .\" manual provided the copyright notice and this permission notice are
8 .\" preserved on all copies.
9 .\"
10 .\" Permission is granted to copy and distribute modified versions of this
11 .\" manual under the conditions for verbatim copying, provided that the
12 .\" entire resulting derived work is distributed under the terms of a
13 .\" permission notice identical to this one.
14 .\"
15 .\" Since the Linux kernel and libraries are constantly changing, this
16 .\" manual page may be incorrect or out-of-date. The author(s) assume no
17 .\" responsibility for errors or omissions, or for damages resulting from
18 .\" the use of the information contained herein. The author(s) may not
19 .\" have taken the same level of care in the production of this manual,
20 .\" which is licensed free of charge, as they might when working
21 .\" professionally.
22 .\"
23 .\" Formatted or processed versions of this manual, if unaccompanied by
24 .\" the source, must acknowledge the copyright and authors of this work.
25 .\" %%%LICENSE_END
26 .\"
27 .TH SCALB 3 2015-03-02 "" "Linux Programmer's Manual"
28 .SH NAME
29 scalb, scalbf, scalbl \- multiply floating-point number
30 by integral power of radix (OBSOLETE)
31 .SH SYNOPSIS
32 .B #include <math.h>
33 .sp
34 .BI "double scalb(double " x ", double " exp );
35 .br
36 .BI "float scalbf(float " x ", float " exp );
37 .br
38 .BI "long double scalbl(long double " x ", long double " exp );
39 .sp
40 Link with \fI\-lm\fP.
41 .sp
42 .in -4n
43 Feature Test Macro Requirements for glibc (see
44 .BR feature_test_macros (7)):
45 .in
46 .sp
47 .ad l
48 .BR scalb ():
49 .RS 4
50 _BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE\ >=\ 500 ||
51 _XOPEN_SOURCE\ &&\ _XOPEN_SOURCE_EXTENDED
52 .RE
53 .br
54 .BR scalbf (),
55 .BR scalbl ():
56 .RS 4
57 _BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE\ >=\ 600
58 .RE
59 .ad b
60 .SH DESCRIPTION
61 These functions multiply their first argument
62 .I x
63 by
64 .B FLT_RADIX
65 (probably 2)
66 to the power of
67 .IR exp ,
68 that is:
69 .nf
70
71 x * FLT_RADIX ** exp
72 .fi
73
74 The definition of
75 .B FLT_RADIX
76 can be obtained by including
77 .IR <float.h> .
78 .\" not in /usr/include but in a gcc lib
79 .SH RETURN VALUE
80 On success, these functions return
81 .IR x
82 *
83 .B FLT_RADIX
84 **
85 .IR exp .
86
87 If
88 .I x
89 or
90 .I exp
91 is a NaN, a NaN is returned.
92
93 If
94 .I x
95 is positive infinity (negative infinity),
96 and
97 .I exp
98 is not negative infinity,
99 positive infinity (negative infinity) is returned.
100
101 If
102 .I x
103 is +0 (\-0), and
104 .I exp
105 is not positive infinity, +0 (\-0) is returned.
106
107 If
108 .I x
109 is zero, and
110 .I exp
111 is positive infinity,
112 a domain error occurs, and
113 a NaN is returned.
114
115 If
116 .I x
117 is an infinity,
118 and
119 .I exp
120 is negative infinity,
121 a domain error occurs, and
122 a NaN is returned.
123
124 If the result overflows,
125 a range error occurs,
126 and the functions return
127 .BR HUGE_VAL ,
128 .BR HUGE_VALF ,
129 or
130 .BR HUGE_VALL ,
131 respectively, with a sign the same as
132 .IR x .
133
134 If the result underflows,
135 a range error occurs,
136 and the functions return zero, with a sign the same as
137 .IR x .
138 .SH ERRORS
139 See
140 .BR math_error (7)
141 for information on how to determine whether an error has occurred
142 when calling these functions.
143 .PP
144 The following errors can occur:
145 .TP
146 Domain error: \fIx\fP is 0, and \fIexp\fP is positive infinity, \
147 or \fIx\fP is positive infinity and \fIexp\fP is negative infinity \
148 and the other argument is not a NaN
149 .\" .I errno
150 .\" is set to
151 .\" .BR EDOM .
152 An invalid floating-point exception
153 .RB ( FE_INVALID )
154 is raised.
155 .TP
156 Range error, overflow
157 .\" .I errno
158 .\" is set to
159 .\" .BR ERANGE .
160 An overflow floating-point exception
161 .RB ( FE_OVERFLOW )
162 is raised.
163 .TP
164 Range error, underflow
165 .\" .I errno
166 .\" is set to
167 .\" .BR ERANGE .
168 An underflow floating-point exception
169 .RB ( FE_UNDERFLOW )
170 is raised.
171 .PP
172 These functions do not set
173 .IR errno .
174 .\" FIXME . Is it intentional that these functions do not set errno?
175 .\" Bug raised: http://sources.redhat.com/bugzilla/show_bug.cgi?id=6803
176 .\" Bug raised: http://sources.redhat.com/bugzilla/show_bug.cgi?id=6804
177 .SH ATTRIBUTES
178 For an explanation of the terms used in this section, see
179 .BR attributes (7).
180 .TS
181 allbox;
182 lbw28 lb lb
183 l l l.
184 Interface Attribute Value
185 T{
186 .BR scalb (),
187 .BR scalbf (),
188 .BR scalbl ()
189 T} Thread safety MT-Safe
190 .TE
191 .SH CONFORMING TO
192 .BR scalb ()
193 is specified in POSIX.1-2001, but marked obsolescent.
194 POSIX.1-2008 removes the specification of
195 .BR scalb (),
196 recommending the use of
197 .BR scalbln (3),
198 .BR scalblnf (3),
199 or
200 .BR scalblnl (3)
201 instead.
202 The
203 .BR scalb ()
204 function is from 4.3BSD.
205
206 .BR scalbf ()
207 and
208 .BR scalbl ()
209 are unstandardized;
210 .BR scalbf ()
211 is nevertheless present on several other systems
212 .\" Looking at header files: scalbf() is present on the
213 .\" BSDs, Tru64, HP-UX 11, Irix 6.5; scalbl() is on HP-UX 11 and Tru64.
214 .SH SEE ALSO
215 .BR ldexp (3),
216 .BR scalbln (3)