1 /* Header file for constants used in floating point <-> decimal conversions.
2    Copyright (C) 1995, 1996, 1997, 1998, 1999, 2002, 2003
3    Free Software Foundation, Inc.
4    This file is part of the GNU C Library.
5 
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.
10 
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.
15 
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.  */
20 
21 #ifndef _FPIOCONST_H
22 #define	_FPIOCONST_H
23 
24 #include <float.h>
25 #include <math.h>
26 
27 
28 /* These values are used by __printf_fp, where they are noncritical (if the
29    value is not large enough, it will just be slower); and by
30    strtof/strtod/strtold, where it is critical (it's used for overflow
31    detection).
32 
33    XXX These should be defined in <float.h>.  For the time being, we have the
34    IEEE754 values here.  */
35 
36 #define FLT128_MAX_10_EXP_LOG	12 /* = floor(log_2(FLT128_MAX_10_EXP)) */
37 
38 /* For strtoq, we need powers of 10 up to floor (log_2 (FLT128_MANT_DIG
39    - FLT128_MIN_EXP + 2)).  */
40 #if !defined __NO_LONG_DOUBLE_MATH && FLT128_MAX_EXP > 1024
41 # define FPIOCONST_POW10_ARRAY_SIZE    15
42 #else
43 # define FPIOCONST_POW10_ARRAY_SIZE    11
44 #endif
45 
46 
47 /* The array with the number representation. */
48 #define __tens __quadmath_tens
49 extern const mp_limb_t __tens[] attribute_hidden;
50 
51 /* Table of powers of ten.  This is used by __printf_fp and by
52    strtof/strtod/strtold.  */
53 struct mp_power
54   {
55     size_t arrayoff;		/* Offset in `__tens'.  */
56     mp_size_t arraysize;	/* Size of the array.  */
57     int p_expo;			/* Exponent of the number 10^(2^i).  */
58     int m_expo;			/* Exponent of the number 10^-(2^i-1).  */
59   };
60 #define _fpioconst_pow10 __quadmath_fpioconst_pow10
61 extern const struct mp_power _fpioconst_pow10[FPIOCONST_POW10_ARRAY_SIZE]
62      attribute_hidden;
63 
64 /* The constants in the array `_fpioconst_pow10' have an offset.  */
65 #if BITS_PER_MP_LIMB == 32
66 # define _FPIO_CONST_OFFSET	2
67 #else
68 # define _FPIO_CONST_OFFSET	1
69 #endif
70 
71 
72 #endif	/* fpioconst.h */
73