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