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