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