mount_setattr.2: Minor tweaks to Christian's patch
[man-pages.git] / man3 / scalbln.3
blob0b1f209ef113eee3f368ce7783a1eb6ff9e8ba2c
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 SCALBLN 3 2021-03-22 "" "Linux Programmer's Manual"
28 .SH NAME
29 scalbn, scalbnf, scalbnl, scalbln, scalblnf, scalblnl \-
30 multiply floating-point number by integral power of radix
31 .SH SYNOPSIS
32 .nf
33 .B #include <math.h>
34 .PP
35 .BI "double scalbln(double " x ", long " exp );
36 .BI "float scalblnf(float " x ", long " exp );
37 .BI "long double scalblnl(long double " x ", long " exp );
38 .PP
39 .BI "double scalbn(double " x ", int " exp );
40 .BI "float scalbnf(float " x ", int " exp );
41 .BI "long double scalbnl(long double " x ", int " exp );
42 .fi
43 .PP
44 Link with \fI\-lm\fP.
45 .PP
46 .RS -4
47 Feature Test Macro Requirements for glibc (see
48 .BR feature_test_macros (7)):
49 .RE
50 .PP
51 .BR scalbln (),
52 .BR scalblnf (),
53 .BR scalblnl ():
54 .nf
55     _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L
56         || /* Since glibc 2.19: */ _DEFAULT_SOURCE
57 .fi
58 .PP
59 .BR scalbn (),
60 .BR scalbnf (),
61 .BR scalbnl ():
62 .nf
63     _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L
64         || /* Since glibc 2.19: */ _DEFAULT_SOURCE
65         || /* Glibc <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE
66 .fi
67 .SH DESCRIPTION
68 These functions multiply their first argument
69 .I x
71 .B FLT_RADIX
72 (probably 2)
73 to the power of
74 .IR exp ,
75 that is:
76 .PP
77 .nf
78     x * FLT_RADIX ** exp
79 .fi
80 .PP
81 The definition of
82 .B FLT_RADIX
83 can be obtained by including
84 .IR <float.h> .
85 .\" not in /usr/include but in a gcc lib
86 .SH RETURN VALUE
87 On success, these functions return
88 .IR x
90 .B FLT_RADIX
92 .IR exp .
93 .PP
95 .I x
96 is a NaN, a NaN is returned.
97 .PP
99 .I x
100 is positive infinity (negative infinity),
101 positive infinity (negative infinity) is returned.
104 .I x
105 is +0 (\-0), +0 (\-0) is returned.
107 If the result overflows,
108 a range error occurs,
109 and the functions return
110 .BR HUGE_VAL ,
111 .BR HUGE_VALF ,
113 .BR HUGE_VALL ,
114 respectively, with a sign the same as
115 .IR x .
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
123 .BR math_error (7)
124 for information on how to determine whether an error has occurred
125 when calling these functions.
127 The following errors can occur:
129 Range error, overflow
130 .\" .I errno
131 .\" is set to
132 .\" .BR ERANGE .
133 An overflow floating-point exception
134 .RB ( FE_OVERFLOW )
135 is raised.
137 Range error, underflow
138 .I errno
139 is set to
140 .BR ERANGE .
141 An underflow floating-point exception
142 .RB ( FE_UNDERFLOW )
143 is raised.
144 .SH VERSIONS
145 These functions first appeared in glibc in version 2.1.
146 .SH ATTRIBUTES
147 For an explanation of the terms used in this section, see
148 .BR attributes (7).
149 .ad l
152 allbox;
153 lbx lb lb
154 l l l.
155 Interface       Attribute       Value
157 .BR scalbn (),
158 .BR scalbnf (),
159 .BR scalbnl (),
160 .BR scalbln (),
161 .BR scalblnf (),
162 .BR scalblnl ()
163 T}      Thread safety   MT-Safe
167 .sp 1
168 .SH CONFORMING TO
169 C99, POSIX.1-2001, POSIX.1-2008.
170 .SH NOTES
171 These functions differ from the obsolete functions described in
172 .BR scalb (3)
173 in the type of their second argument.
174 The functions described on this page have a second argument
175 of an integral type, while those in
176 .BR scalb (3)
177 have a second argument of type
178 .IR double .
181 .B FLT_RADIX
182 equals 2 (which is usual), then
183 .BR scalbn ()
184 is equivalent to
185 .BR ldexp (3).
186 .SH BUGS
187 Before glibc 2.20,
188 .\" http://sources.redhat.com/bugzilla/show_bug.cgi?id=6803
189 these functions did not set
190 .I errno
191 for range errors.
192 .SH SEE ALSO
193 .BR ldexp (3),
194 .BR scalb (3)