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
25
27 These functions shall compute x * FLT_RADIX**n efficiently, not nor‐
28 mally by computing FLT_RADIX**n explicitly.
29
30 An application wishing to check for error situations should set errno
31 to zero and call feclearexcept(FE_ALL_EXCEPT) before calling these
32 functions. On return, if errno is non-zero or fetestexcept(FE_INVALID
33 | FE_DIVBYZERO | FE_OVERFLOW | FE_UNDERFLOW) is non-zero, an error has
34 occurred.
35
37 Upon successful completion, these functions shall return
38 x * FLT_RADIX**n.
39
40 If the result would cause overflow, a range error shall occur and these
41 functions shall return ±HUGE_VAL, ±HUGE_VALF, and ±HUGE_VALL (according
42 to the sign of x) as appropriate for the return type of the function.
43
44 If the correct value would cause underflow, and is not representable, a
45 range error may occur, and either 0.0 (if supported), or an implemen‐
46 tation-defined value shall be returned.
47
48 If x is NaN, a NaN shall be returned.
49
50 If x is ±0 or ±Inf, x shall be returned.
51
52 If n is 0, x shall be returned.
53
54 If the correct value would cause underflow, and is representable, a
55 range error may occur and the correct value shall be returned.
56
58 These functions shall fail if:
59
60 Range Error
61 The result overflows.
62
63 If the integer expression (math_errhandling & MATH_ERRNO) is non-zero,
64 then errno shall be set to [ERANGE]. If the integer expression
65 (math_errhandling & MATH_ERREXCEPT) is non-zero, then the overflow
66 floating-point exception shall be raised.
67
68
69 These functions may fail if:
70
71 Range Error
72 The result underflows.
73
74 If the integer expression (math_errhandling & MATH_ERRNO) is non-zero,
75 then errno shall be set to [ERANGE]. If the integer expression
76 (math_errhandling & MATH_ERREXCEPT) is non-zero, then the underflow
77 floating-point exception shall be raised.
78
79
80 The following sections are informative.
81
83 None.
84
86 On error, the expressions (math_errhandling & MATH_ERRNO) and
87 (math_errhandling & MATH_ERREXCEPT) are independent of each other, but
88 at least one of them must be non-zero.
89
91 These functions are named so as to avoid conflicting with the histori‐
92 cal definition of the scalb() function from the Single UNIX Specifica‐
93 tion. The difference is that the scalb() function has a second argu‐
94 ment of double instead of int. The scalb() function is not part of the
95 ISO C standard. The three functions whose second type is long are pro‐
96 vided because the factor required to scale from the smallest positive
97 floating-point value to the largest finite one, on many implementa‐
98 tions, is too large to represent in the minimum-width int format.
99
101 None.
102
104 feclearexcept(), fetestexcept(), scalb(), the Base Definitions volume
105 of IEEE Std 1003.1-2001, Section 4.18, Treatment of Error Conditions
106 for Mathematical Functions, <math.h>
107
109 Portions of this text are reprinted and reproduced in electronic form
110 from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
111 -- Portable Operating System Interface (POSIX), The Open Group Base
112 Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of
113 Electrical and Electronics Engineers, Inc and The Open Group. In the
114 event of any discrepancy between this version and the original IEEE and
115 The Open Group Standard, the original IEEE and The Open Group Standard
116 is the referee document. The original Standard can be obtained online
117 at http://www.opengroup.org/unix/online.html .
118
119
120
121IEEE/The Open Group 2003 SCALBLN(3P)