]> git.ipfire.org Git - thirdparty/glibc.git/blame - misc/qefgcvt.c
Update copyright dates with scripts/update-copyrights.
[thirdparty/glibc.git] / misc / qefgcvt.c
CommitLineData
19361cb7 1/* Compatibility functions for floating point formatting, long double version.
688903eb 2 Copyright (C) 1996-2018 Free Software Foundation, Inc.
19361cb7 3 This file is part of the GNU C Library.
2064087b 4
19361cb7 5 The GNU C Library is free software; you can redistribute it and/or
41bdb6e2
AJ
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.
2064087b 9
19361cb7
UD
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
41bdb6e2 13 Lesser General Public License for more details.
2064087b 14
41bdb6e2 15 You should have received a copy of the GNU Lesser General Public
59ba27a6
PE
16 License along with the GNU C Library; if not, see
17 <http://www.gnu.org/licenses/>. */
2064087b 18
b113c12c
UD
19#include <float.h>
20
2064087b
RM
21#define FLOAT_TYPE long double
22#define FUNC_PREFIX q
23#define FLOAT_FMT_FLAG "L"
1cab5444
UD
24/* Actually we have to write (LDBL_DIG + log10 (LDBL_MAX_10_EXP)) but
25 we don't have log10 available in the preprocessor. Since we cannot
26 assume anything on the used `long double' format be generous. */
b113c12c 27#define MAXDIG (NDIGIT_MAX + 12)
887e7ab6 28#define FCVT_MAXDIG (LDBL_MAX_10_EXP + MAXDIG)
b113c12c
UD
29#if LDBL_MANT_DIG == 64
30# define NDIGIT_MAX 21
f9a2a636
UD
31#elif LDBL_MANT_DIG == 53
32# define NDIGIT_MAX 17
33#elif LDBL_MANT_DIG == 113
34# define NDIGIT_MAX 36
5ce98c3f
UD
35#elif LDBL_MANT_DIG == 106
36# define NDIGIT_MAX 34
f9a2a636
UD
37#elif LDBL_MANT_DIG == 56
38# define NDIGIT_MAX 18
b113c12c 39#else
f9a2a636
UD
40/* See IEEE 854 5.6, table 2 for this formula. Unfortunately we need a
41 compile time constant here, so we cannot use it. */
42# error "NDIGIT_MAX must be precomputed"
b113c12c
UD
43# define NDIGIT_MAX (lrint (ceil (M_LN2 / M_LN10 * LDBL_MANT_DIG + 1.0)))
44#endif
2064087b
RM
45
46#include "efgcvt.c"