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