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