Home | History | Annotate | Line # | Download | only in printf
      1  1.1  mrg /* Header file for constants used in floating point <-> decimal conversions.
      2  1.1  mrg    Copyright (C) 1995, 1996, 1997, 1998, 1999, 2002, 2003
      3  1.1  mrg    Free Software Foundation, Inc.
      4  1.1  mrg    This file is part of the GNU C Library.
      5  1.1  mrg 
      6  1.1  mrg    The GNU C Library is free software; you can redistribute it and/or
      7  1.1  mrg    modify it under the terms of the GNU Lesser General Public
      8  1.1  mrg    License as published by the Free Software Foundation; either
      9  1.1  mrg    version 2.1 of the License, or (at your option) any later version.
     10  1.1  mrg 
     11  1.1  mrg    The GNU C Library is distributed in the hope that it will be useful,
     12  1.1  mrg    but WITHOUT ANY WARRANTY; without even the implied warranty of
     13  1.1  mrg    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     14  1.1  mrg    Lesser General Public License for more details.
     15  1.1  mrg 
     16  1.1  mrg    You should have received a copy of the GNU Lesser General Public
     17  1.1  mrg    License along with the GNU C Library; if not, write to the Free
     18  1.1  mrg    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
     19  1.1  mrg    02111-1307 USA.  */
     20  1.1  mrg 
     21  1.1  mrg #ifndef _FPIOCONST_H
     22  1.1  mrg #define	_FPIOCONST_H
     23  1.1  mrg 
     24  1.1  mrg #include <float.h>
     25  1.1  mrg #include <math.h>
     26  1.1  mrg 
     27  1.1  mrg 
     28  1.1  mrg /* These values are used by __printf_fp, where they are noncritical (if the
     29  1.1  mrg    value is not large enough, it will just be slower); and by
     30  1.1  mrg    strtof/strtod/strtold, where it is critical (it's used for overflow
     31  1.1  mrg    detection).
     32  1.1  mrg 
     33  1.1  mrg    XXX These should be defined in <float.h>.  For the time being, we have the
     34  1.1  mrg    IEEE754 values here.  */
     35  1.1  mrg 
     36  1.1  mrg #define FLT128_MAX_10_EXP_LOG	12 /* = floor(log_2(FLT128_MAX_10_EXP)) */
     37  1.1  mrg 
     38  1.1  mrg /* For strtoq, we need powers of 10 up to floor (log_2 (FLT128_MANT_DIG
     39  1.1  mrg    - FLT128_MIN_EXP + 2)).  */
     40  1.1  mrg #if !defined __NO_LONG_DOUBLE_MATH && FLT128_MAX_EXP > 1024
     41  1.1  mrg # define FPIOCONST_POW10_ARRAY_SIZE    15
     42  1.1  mrg #else
     43  1.1  mrg # define FPIOCONST_POW10_ARRAY_SIZE    11
     44  1.1  mrg #endif
     45  1.1  mrg 
     46  1.1  mrg 
     47  1.1  mrg /* The array with the number representation. */
     48  1.1  mrg #define __tens __quadmath_tens
     49  1.1  mrg extern const mp_limb_t __tens[] attribute_hidden;
     50  1.1  mrg 
     51  1.1  mrg /* Table of powers of ten.  This is used by __printf_fp and by
     52  1.1  mrg    strtof/strtod/strtold.  */
     53  1.1  mrg struct mp_power
     54  1.1  mrg   {
     55  1.1  mrg     size_t arrayoff;		/* Offset in `__tens'.  */
     56  1.1  mrg     mp_size_t arraysize;	/* Size of the array.  */
     57  1.1  mrg     int p_expo;			/* Exponent of the number 10^(2^i).  */
     58  1.1  mrg     int m_expo;			/* Exponent of the number 10^-(2^i-1).  */
     59  1.1  mrg   };
     60  1.1  mrg #define _fpioconst_pow10 __quadmath_fpioconst_pow10
     61  1.1  mrg extern const struct mp_power _fpioconst_pow10[FPIOCONST_POW10_ARRAY_SIZE]
     62  1.1  mrg      attribute_hidden;
     63  1.1  mrg 
     64  1.1  mrg /* The constants in the array `_fpioconst_pow10' have an offset.  */
     65  1.1  mrg #if BITS_PER_MP_LIMB == 32
     66  1.1  mrg # define _FPIO_CONST_OFFSET	2
     67  1.1  mrg #else
     68  1.1  mrg # define _FPIO_CONST_OFFSET	1
     69  1.1  mrg #endif
     70  1.1  mrg 
     71  1.1  mrg 
     72  1.1  mrg #endif	/* fpioconst.h */
     73