1 /* Macros for the implementation of *cvt functions, double version.
2 Copyright (C) 1995-2024 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <https://www.gnu.org/licenses/>. */
21 #define FLOAT_TYPE double
23 #define FLOAT_FMT_FLAG
24 #define FLOAT_NAME_EXT
25 #define FLOAT_MIN_10_EXP DBL_MIN_10_EXP
26 /* Actually we have to write (DBL_DIG + log10 (DBL_MAX_10_EXP)) but we
27 don't have log10 available in the preprocessor. */
28 #define MAXDIG (NDIGIT_MAX + 3)
29 #define FCVT_MAXDIG (DBL_MAX_10_EXP + MAXDIG)
30 #if DBL_MANT_DIG == 53
31 # define NDIGIT_MAX 17
32 #elif DBL_MANT_DIG == 24
34 #elif DBL_MANT_DIG == 56
35 # define NDIGIT_MAX 18
37 /* See IEEE 854 5.6, table 2 for this formula. Unfortunately we need a
38 compile time constant here, so we cannot use it. */
39 # error "NDIGIT_MAX must be precomputed"
40 # define NDIGIT_MAX (lrint (ceil (M_LN2 / M_LN10 * DBL_MANT_DIG + 1.0)))
42 #if DBL_MIN_10_EXP == -37
43 # define FLOAT_MIN_10_NORM 1.0e-37
44 #elif DBL_MIN_10_EXP == -307
45 # define FLOAT_MIN_10_NORM 1.0e-307
46 #elif DBL_MIN_10_EXP == -4931
47 # define FLOAT_MIN_10_NORM 1.0e-4931
49 /* libc can't depend on libm. */
50 # error "FLOAT_MIN_10_NORM must be precomputed"
51 # define FLOAT_MIN_10_NORM exp10 (DBL_MIN_10_EXP)