1SCALB(P)                   POSIX Programmer's Manual                  SCALB(P)
2
3
4

NAME

6       scalb - load exponent of a radix-independent floating-point number
7

SYNOPSIS

9       #include <math.h>
10
11       double scalb(double x, double n);
12
13

DESCRIPTION

15       The  scalb() function shall compute x*r**n, where r is the radix of the
16       machine's floating-point arithmetic. When r  is  2,  scalb()  shall  be
17       equivalent to ldexp() . The value of r is FLT_RADIX which is defined in
18       <float.h>.
19
20       An application wishing to check for error situations should  set  errno
21       to  zero  and  call  feclearexcept(FE_ALL_EXCEPT)  before calling these
22       functions.  On return, if errno is non-zero or  fetestexcept(FE_INVALID
23       |  FE_DIVBYZERO | FE_OVERFLOW | FE_UNDERFLOW) is non-zero, an error has
24       occurred.
25

RETURN VALUE

27       Upon successful completion, the scalb() function shall return x*r**n.
28
29       If x or n is NaN, a NaN shall be returned.
30
31       If n is zero, x shall be returned.
32
33       If x is ±Inf and n is not -Inf, x shall be returned.
34
35       If x is ±0 and n is not +Inf, x shall be returned.
36
37       If x is ±0 and n is +Inf, a domain error shall occur, and either a  NaN
38       (if supported), or an implementation-defined value shall be returned.
39
40       If  x  is  ±Inf and n is -Inf, a domain error shall occur, and either a
41       NaN  (if  supported),  or  an  implementation-defined  value  shall  be
42       returned.
43
44       If  the  result  would cause an overflow, a range error shall occur and
45       ±HUGE_VAL (according to the sign of x) shall be returned.
46
47       If the correct value would cause underflow,  and  is  representable,  a
48       range error may occur and the correct value shall be returned.
49
50       If the correct value would cause underflow, and is not representable, a
51       range error may occur, and 0.0 shall be returned.
52

ERRORS

54       The scalb() function shall fail if:
55
56       Domain Error
57              If x is zero and n is +Inf, or x is Inf and n is -Inf.
58
59       If the integer expression (math_errhandling & MATH_ERRNO) is  non-zero,
60       then   errno  shall  be  set  to  [EDOM].  If  the  integer  expression
61       (math_errhandling &  MATH_ERREXCEPT)  is  non-zero,  then  the  invalid
62       floating-point exception shall be raised.
63
64       Range Error
65              The result would overflow.
66
67       If  the integer expression (math_errhandling & MATH_ERRNO) is non-zero,
68       then errno  shall  be  set  to  [ERANGE].  If  the  integer  expression
69       (math_errhandling  &  MATH_ERREXCEPT)  is  non-zero,  then the overflow
70       floating-point exception shall be raised.
71
72
73       The scalb() function may fail if:
74
75       Range Error
76              The result underflows.
77
78       If the integer expression (math_errhandling & MATH_ERRNO) is  non-zero,
79       then  errno  shall  be  set  to  [ERANGE].  If  the  integer expression
80       (math_errhandling & MATH_ERREXCEPT) is  non-zero,  then  the  underflow
81       floating-point exception shall be raised.
82
83
84       The following sections are informative.
85

EXAMPLES

87       None.
88

APPLICATION USAGE

90       Applications  should use either scalbln(), scalblnf(), or scalblnl() in
91       preference to this function.
92
93       IEEE Std 1003.1-2001 only defines the behavior for the scalb() function
94       when the n argument is an integer, a NaN, or Inf. The behavior of other
95       values for the n argument is unspecified.
96
97       On  error,  the  expressions  (math_errhandling   &   MATH_ERRNO)   and
98       (math_errhandling  & MATH_ERREXCEPT) are independent of each other, but
99       at least one of them must be non-zero.
100

RATIONALE

102       None.
103

FUTURE DIRECTIONS

105       None.
106

SEE ALSO

108       feclearexcept() , fetestexcept() , ilogb() , ldexp() , logb()  ,  scal‐
109       bln()  ,  the  Base Definitions volume of IEEE Std 1003.1-2001, Section
110       4.18,  Treatment  of  Error  Conditions  for  Mathematical   Functions,
111       <float.h>, <math.h>
112
114       Portions  of  this text are reprinted and reproduced in electronic form
115       from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
116       --  Portable  Operating  System  Interface (POSIX), The Open Group Base
117       Specifications Issue 6, Copyright (C) 2001-2003  by  the  Institute  of
118       Electrical  and  Electronics  Engineers, Inc and The Open Group. In the
119       event of any discrepancy between this version and the original IEEE and
120       The  Open Group Standard, the original IEEE and The Open Group Standard
121       is the referee document. The original Standard can be  obtained  online
122       at http://www.opengroup.org/unix/online.html .
123
124
125
126IEEE/The Open Group                  2003                             SCALB(P)
Impressum