2 .\" Copyright 1993 David Metcalfe (david@prism.demon.co.uk)
4 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
6 .\" References consulted:
7 .\" Linux libc source code
8 .\" Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991)
10 .\" Modified 1993-07-24 by Rik Faith (faith@cs.unc.edu)
11 .\" Modified 2002-07-27 by Walter Harms
12 .\" (walter.harms@informatik.uni-oldenburg.de)
14 .TH frexp 3 (date) "Linux man-pages (unreleased)"
16 frexp, frexpf, frexpl \- convert floating-point number to fractional
17 and integral components
20 .RI ( libm ", " \-lm )
25 .BI "double frexp(double " x ", int *" exp );
26 .BI "float frexpf(float " x ", int *" exp );
27 .BI "long double frexpl(long double " x ", int *" exp );
31 Feature Test Macro Requirements for glibc (see
32 .BR feature_test_macros (7)):
38 _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L
39 || /* Since glibc 2.19: */ _DEFAULT_SOURCE
40 || /* glibc <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE
43 These functions are used to split the number
46 normalized fraction and an exponent which is stored in
49 These functions return the normalized fraction.
53 the normalized fraction is
56 and its absolute value is always in the range 1/2 (inclusive) to
57 1 (exclusive), that is, [0.5,1).
61 is zero, then the normalized fraction is
62 zero and zero is stored in
68 a NaN is returned, and the value of
74 is positive infinity (negative infinity),
75 positive infinity (negative infinity) is returned, and the value of
81 For an explanation of the terms used in this section, see
87 Interface Attribute Value
94 T} Thread safety MT-Safe
101 The variant returning
106 The program below produces results such as the following:
110 .RB "$" " ./a.out 2560"
111 frexp(2560, &e) = 0.625: 0.625 * 2\[ha]12 = 2560
112 .RB "$" " ./a.out \-4"
113 frexp(\-4, &e) = \-0.5: \-0.5 * 2\[ha]3 = \-4
118 .\" SRC BEGIN (frexp.c)
126 main(int argc, char *argv[])
131 x = strtod(argv[1], NULL);
134 printf("frexp(%g, &e) = %g: %g * %d\[ha]%d = %g\en", x, r, r, 2, exp, x);