.
[glibc/history.git] / misc / qefgcvt_r.c
bloba03ff748efcaf6ea5a8dd72bda7a5a176b4a72b5
1 /* Compatibility functions for floating point formatting, reentrant,
2 long double versions.
3 Copyright (C) 1996, 1997, 1999 Free Software Foundation, Inc.
4 This file is part of the GNU C Library.
6 The GNU C Library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Lesser General Public
8 License as published by the Free Software Foundation; either
9 version 2.1 of the License, or (at your option) any later version.
11 The GNU C Library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Lesser General Public License for more details.
16 You should have received a copy of the GNU Lesser General Public
17 License along with the GNU C Library; if not, write to the Free
18 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
19 02111-1307 USA. */
21 #include <float.h>
23 #define FLOAT_TYPE long double
24 #define FUNC_PREFIX q
25 #define FLOAT_FMT_FLAG "L"
26 #define FLOAT_NAME_EXT l
27 #define FLOAT_MIN_10_EXP LDBL_MIN_10_EXP
28 #if LDBL_MANT_DIG == 64
29 # define NDIGIT_MAX 21
30 #elif LDBL_MANT_DIG == 53
31 # define NDIGIT_MAX 17
32 #elif LDBL_MANT_DIG == 113
33 # define NDIGIT_MAX 36
34 #elif LDBL_MANT_DIG == 106
35 # define NDIGIT_MAX 34
36 #elif LDBL_MANT_DIG == 56
37 # define NDIGIT_MAX 18
38 #else
39 /* See IEEE 854 5.6, table 2 for this formula. Unfortunately we need a
40 compile time constant here, so we cannot use it. */
41 # error "NDIGIT_MAX must be precomputed"
42 # define NDIGIT_MAX (lrint (ceil (M_LN2 / M_LN10 * LDBL_MANT_DIG + 1.0)))
43 #endif
44 #if LDBL_MIN_10_EXP == -37
45 # define FLOAT_MIN_10_NORM 1.0e-37L
46 #elif LDBL_MIN_10_EXP == -291
47 # define FLOAT_MIN_10_NORM 1.0e-291L
48 #elif LDBL_MIN_10_EXP == -307
49 # define FLOAT_MIN_10_NORM 1.0e-307L
50 #elif LDBL_MIN_10_EXP == -4931
51 # define FLOAT_MIN_10_NORM 1.0e-4931L
52 #else
53 /* libc can't depend on libm. */
54 # error "FLOAT_MIN_10_NORM must be precomputed"
55 # define FLOAT_MIN_10_NORM exp10l (LDBL_MIN_10_EXP)
56 #endif
58 #include "efgcvt_r.c"