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

NAME

6       ldexp, ldexpf, ldexpl - load exponent of a floating-point number
7

SYNOPSIS

9       #include <math.h>
10
11       double ldexp(double x, int exp);
12       float ldexpf(float x, int exp);
13       long double ldexpl(long double x, int exp);
14
15

DESCRIPTION

17       These functions shall compute the quantity x * 2**exp.
18
19       An  application  wishing to check for error situations should set errno
20       to zero and  call  feclearexcept(FE_ALL_EXCEPT)  before  calling  these
21       functions.   On return, if errno is non-zero or fetestexcept(FE_INVALID
22       | FE_DIVBYZERO | FE_OVERFLOW | FE_UNDERFLOW) is non-zero, an error  has
23       occurred.
24

RETURN VALUE

26       Upon  successful  completion, these functions shall return x multiplied
27       by 2, raised to the power exp.
28
29       If these functions would cause overflow, a range error shall occur  and
30       ldexp(), ldexpf(), and ldexpl() shall return ±HUGE_VAL, ±HUGE_VALF, and
31       ±HUGE_VALL (according to the sign of x), respectively.
32
33       If the correct value would cause underflow, and is not representable, a
34       range error may occur, and    either 0.0 (if supported), or   an imple‐
35       mentation-defined value shall be returned.
36
37       If x is NaN, a NaN shall be returned.
38
39       If x is ±0 or ±Inf, x shall be returned.
40
41       If exp is 0, x shall be returned.
42
43       If the correct value would cause underflow,  and  is  representable,  a
44       range error may occur and the correct value shall be returned.
45

ERRORS

47       These functions shall fail if:
48
49       Range Error
50              The result overflows.
51
52       If  the integer expression (math_errhandling & MATH_ERRNO) is non-zero,
53       then errno  shall  be  set  to  [ERANGE].  If  the  integer  expression
54       (math_errhandling  &  MATH_ERREXCEPT)  is  non-zero,  then the overflow
55       floating-point exception shall be raised.
56
57
58       These functions may fail if:
59
60       Range Error
61              The result underflows.
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  underflow
66       floating-point exception shall be raised.
67
68
69       The following sections are informative.
70

EXAMPLES

72       None.
73

APPLICATION USAGE

75       On   error,   the   expressions  (math_errhandling  &  MATH_ERRNO)  and
76       (math_errhandling & MATH_ERREXCEPT) are independent of each other,  but
77       at least one of them must be non-zero.
78

RATIONALE

80       None.
81

FUTURE DIRECTIONS

83       None.
84

SEE ALSO

86       feclearexcept() , fetestexcept() , frexp() , isnan() , the Base Defini‐
87       tions volume of IEEE Std 1003.1-2001, Section 4.18, Treatment of  Error
88       Conditions for Mathematical Functions, <math.h>
89
91       Portions  of  this text are reprinted and reproduced in electronic form
92       from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
93       --  Portable  Operating  System  Interface (POSIX), The Open Group Base
94       Specifications Issue 6, Copyright (C) 2001-2003  by  the  Institute  of
95       Electrical  and  Electronics  Engineers, Inc and The Open Group. In the
96       event of any discrepancy between this version and the original IEEE and
97       The  Open Group Standard, the original IEEE and The Open Group Standard
98       is the referee document. The original Standard can be  obtained  online
99       at http://www.opengroup.org/unix/online.html .
100
101
102
103IEEE/The Open Group                  2003                             LDEXP(P)
Impressum