1ldexp(3M)               Mathematical Library Functions               ldexp(3M)
2
3
4

NAME

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

SYNOPSIS

9       c99 [ flag... ] file... -lm [ library... ]
10       #include <math.h>
11
12       double ldexp(double x, int exp);
13
14
15       float ldexpf(float x, int exp);
16
17
18       long double ldexpl(long double x, int exp);
19
20

DESCRIPTION

22       These functions computes the quantity x* 2^exp.
23

RETURN VALUES

25       Upon  successful  completion,  these functions return x multiplied by 2
26       raised to the power exp.
27
28
29       If these functions would cause  overflow,  a  range  error  occurs  and
30       ldexp(),  ldexpf(),  and  ldexpl()  return  ±HUGE_VAL,  ±HUGE_VALF, and
31       ±HUGE_VALL (according to the sign of x), respectively.
32
33
34       If x is NaN, a NaN is returned.
35
36
37       If x is ±0 or ±Inf, x is returned.
38
39
40       If exp  is 0, x is returned.
41

ERRORS

43       These functions will fail if:
44
45       Range Error    The result overflows.
46
47                      If   the   integer   expression   (math_errhandling    &
48                      MATH_ERREXCEPT) is non-zero, the overflow floating-point
49                      exception is raised.
50
51                      The ldexp() function sets errno to ERANGE if the  result
52                      overflows.
53
54

USAGE

56       An  application  wanting to check for exceptions should call feclearex‐
57       cept(FE_ALL_EXCEPT) before  calling  these  functions.  On  return,  if
58       fetestexcept(FE_INVALID | FE_DIVBYZERO | FE_OVERFLOW | FE_UNDERFLOW) is
59       non-zero, an exception has been raised. An  application  should  either
60       examine the return value or check the floating point exception flags to
61       detect exceptions.
62
63
64       An application can also set errno  to  0  before  calling  ldexp().  On
65       return,  if  errno is non-zero, an error has occurred. The ldexpf() and
66       ldexpl() functions do not set errno.
67

ATTRIBUTES

69       See attributes(5) for descriptions of the following attributes:
70
71
72
73
74       ┌─────────────────────────────┬─────────────────────────────┐
75       │      ATTRIBUTE TYPE         │      ATTRIBUTE VALUE        │
76       ├─────────────────────────────┼─────────────────────────────┤
77       │Interface Stability          │Standard                     │
78       ├─────────────────────────────┼─────────────────────────────┤
79       │MT-Level                     │MT-Safe                      │
80       └─────────────────────────────┴─────────────────────────────┘
81

SEE ALSO

83       frexp(3M), isnan(3M), modf(3M), attributes(5), standards(5)
84
85
86
87SunOS 5.11                        12 Jul 2006                        ldexp(3M)
Impressum