1SCALBLN(3P) POSIX Programmer's Manual SCALBLN(3P)
2
3
4
6 This manual page is part of the POSIX Programmer's Manual. The Linux
7 implementation of this interface may differ (consult the corresponding
8 Linux manual page for details of Linux behavior), or the interface may
9 not be implemented on Linux.
10
11
13 scalbln, scalblnf, scalblnl, scalbn, scalbnf, scalbnl — compute expo‐
14 nent using FLT_RADIX
15
17 #include <math.h>
18
19 double scalbln(double x, long n);
20 float scalblnf(float x, long n);
21 long double scalblnl(long double x, long n);
22 double scalbn(double x, int n);
23 float scalbnf(float x, int n);
24 long double scalbnl(long double x, int n);
25
27 The functionality described on this reference page is aligned with the
28 ISO C standard. Any conflict between the requirements described here
29 and the ISO C standard is unintentional. This volume of POSIX.1‐2008
30 defers to the ISO C standard.
31
32 These functions shall compute x * FLT_RADIXn efficiently, not normally
33 by computing FLT_RADIXn explicitly.
34
35 An application wishing to check for error situations should set errno
36 to zero and call feclearexcept(FE_ALL_EXCEPT) before calling these
37 functions. On return, if errno is non-zero or fetestexcept(FE_INVALID |
38 FE_DIVBYZERO | FE_OVERFLOW | FE_UNDERFLOW) is non-zero, an error has
39 occurred.
40
42 Upon successful completion, these functions shall return
43 x * FLT_RADIXn.
44
45 If the result would cause overflow, a range error shall occur and these
46 functions shall return ±HUGE_VAL, ±HUGE_VALF, and ±HUGE_VALL (according
47 to the sign of x) as appropriate for the return type of the function.
48
49 If the correct value would cause underflow, and is not representable, a
50 range error may occur, and scalbln(), scalblnf(), scalblnl(), scalbn(),
51 scalbnf(), and scalbnl() shall return 0.0, or (if IEC 60559 Floating-
52 Point is not supported) an implementation-defined value no greater in
53 magnitude than DBL_MIN, FLT_MIN, LDBL_MIN, DBL_MIN, FLT_MIN, and
54 LDBL_MIN, respectively.
55
56 If x is NaN, a NaN shall be returned.
57
58 If x is ±0 or ±Inf, x shall be returned.
59
60 If n is 0, x shall be returned.
61
62 If the correct value would cause underflow, and is representable, a
63 range error may occur and the correct value shall be returned.
64
66 These functions shall fail if:
67
68 Range Error The result overflows.
69
70 If the integer expression (math_errhandling & MATH_ERRNO)
71 is non-zero, then errno shall be set to [ERANGE]. If the
72 integer expression (math_errhandling & MATH_ERREXCEPT) is
73 non-zero, then the overflow floating-point exception shall
74 be raised.
75
76 These functions may fail if:
77
78 Range Error The result underflows.
79
80 If the integer expression (math_errhandling & MATH_ERRNO)
81 is non-zero, then errno shall be set to [ERANGE]. If the
82 integer expression (math_errhandling & MATH_ERREXCEPT) is
83 non-zero, then the underflow floating-point exception shall
84 be raised.
85
86 The following sections are informative.
87
89 None.
90
92 On error, the expressions (math_errhandling & MATH_ERRNO) and
93 (math_errhandling & MATH_ERREXCEPT) are independent of each other, but
94 at least one of them must be non-zero.
95
97 These functions are named so as to avoid conflicting with the histori‐
98 cal definition of the scalb() function from the Single UNIX Specifica‐
99 tion. The difference is that the scalb() function has a second argument
100 of double instead of int. The scalb() function is not part of the
101 ISO C standard. The three functions whose second type is long are pro‐
102 vided because the factor required to scale from the smallest positive
103 floating-point value to the largest finite one, on many implementa‐
104 tions, is too large to represent in the minimum-width int format.
105
107 None.
108
110 feclearexcept(), fetestexcept()
111
112 The Base Definitions volume of POSIX.1‐2008, Section 4.19, Treatment of
113 Error Conditions for Mathematical Functions, <math.h>
114
116 Portions of this text are reprinted and reproduced in electronic form
117 from IEEE Std 1003.1, 2013 Edition, Standard for Information Technology
118 -- Portable Operating System Interface (POSIX), The Open Group Base
119 Specifications Issue 7, Copyright (C) 2013 by the Institute of Electri‐
120 cal and Electronics Engineers, Inc and The Open Group. (This is
121 POSIX.1-2008 with the 2013 Technical Corrigendum 1 applied.) In the
122 event of any discrepancy between this version and the original IEEE and
123 The Open Group Standard, the original IEEE and The Open Group Standard
124 is the referee document. The original Standard can be obtained online
125 at http://www.unix.org/online.html .
126
127 Any typographical or formatting errors that appear in this page are
128 most likely to have been introduced during the conversion of the source
129 files to man page format. To report such errors, see https://www.ker‐
130 nel.org/doc/man-pages/reporting_bugs.html .
131
132
133
134IEEE/The Open Group 2013 SCALBLN(3P)