1ldexp(3)                   Library Functions Manual                   ldexp(3)
2
3
4

NAME

6       ldexp,  ldexpf,  ldexpl  -  multiply  floating-point number by integral
7       power of 2
8

LIBRARY

10       Math library (libm, -lm)
11

SYNOPSIS

13       #include <math.h>
14
15       double ldexp(double x, int exp);
16       float ldexpf(float x, int exp);
17       long double ldexpl(long double x, int exp);
18
19   Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
20
21       ldexpf(), ldexpl():
22           _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L
23               || /* Since glibc 2.19: */ _DEFAULT_SOURCE
24               || /* glibc <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE
25

DESCRIPTION

27       These functions return the result  of  multiplying  the  floating-point
28       number x by 2 raised to the power exp.
29

RETURN VALUE

31       On success, these functions return x * (2^exp).
32
33       If exp is zero, then x is returned.
34
35       If x is a NaN, a NaN is returned.
36
37       If x is positive infinity (negative infinity), positive infinity (nega‐
38       tive infinity) is returned.
39
40       If the result underflows, a range error occurs, and zero is returned.
41
42       If the result overflows, a range error occurs, and the functions return
43       HUGE_VAL,  HUGE_VALF,  or HUGE_VALL, respectively, with a sign the same
44       as x.
45

ERRORS

47       See math_error(7) for information on how to determine whether an  error
48       has occurred when calling these functions.
49
50       The following errors can occur:
51
52       Range error, overflow
53              errno  is  set  to ERANGE.  An overflow floating-point exception
54              (FE_OVERFLOW) is raised.
55
56       Range error, underflow
57              errno is set to ERANGE.  An underflow  floating-point  exception
58              (FE_UNDERFLOW) is raised.
59

ATTRIBUTES

61       For  an  explanation  of  the  terms  used  in  this  section,  see at‐
62       tributes(7).
63
64       ┌────────────────────────────────────────────┬───────────────┬─────────┐
65Interface                                   Attribute     Value   
66       ├────────────────────────────────────────────┼───────────────┼─────────┤
67ldexp(), ldexpf(), ldexpl()                 │ Thread safety │ MT-Safe │
68       └────────────────────────────────────────────┴───────────────┴─────────┘
69

STANDARDS

71       C11, POSIX.1-2008.
72

HISTORY

74       C99, POSIX.1-2001.
75
76       The variant returning double also conforms to SVr4, 4.3BSD, C89.
77

SEE ALSO

79       frexp(3), modf(3), scalbln(3)
80
81
82
83Linux man-pages 6.05              2023-07-20                          ldexp(3)
Impressum