Back to index

glibc  2.9
fpioconst.h
Go to the documentation of this file.
00001 /* Header file for constants used in floating point <-> decimal conversions.
00002    Copyright (C) 1995, 1996, 1997, 1998, 1999, 2002, 2003
00003    Free Software Foundation, Inc.
00004    This file is part of the GNU C Library.
00005 
00006    The GNU C Library is free software; you can redistribute it and/or
00007    modify it under the terms of the GNU Lesser General Public
00008    License as published by the Free Software Foundation; either
00009    version 2.1 of the License, or (at your option) any later version.
00010 
00011    The GNU C Library is distributed in the hope that it will be useful,
00012    but WITHOUT ANY WARRANTY; without even the implied warranty of
00013    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014    Lesser General Public License for more details.
00015 
00016    You should have received a copy of the GNU Lesser General Public
00017    License along with the GNU C Library; if not, write to the Free
00018    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
00019    02111-1307 USA.  */
00020 
00021 #ifndef _FPIOCONST_H
00022 #define       _FPIOCONST_H
00023 
00024 #include <float.h>
00025 #include <math.h>
00026 #include <gmp.h>
00027 
00028 
00029 /* These values are used by __printf_fp, where they are noncritical (if the
00030    value is not large enough, it will just be slower); and by
00031    strtof/strtod/strtold, where it is critical (it's used for overflow
00032    detection).
00033 
00034    XXX These should be defined in <float.h>.  For the time being, we have the
00035    IEEE754 values here.  */
00036 
00037 #if !defined __NO_LONG_DOUBLE_MATH && __LDBL_MAX_EXP__ > 1024
00038 # define LDBL_MAX_10_EXP_LOG       12 /* = floor(log_2(LDBL_MAX_10_EXP)) */
00039 #else
00040 # define LDBL_MAX_10_EXP_LOG       8 /* = floor(log_2(LDBL_MAX_10_EXP)) */
00041 #endif
00042 #define DBL_MAX_10_EXP_LOG  8 /* = floor(log_2(DBL_MAX_10_EXP)) */
00043 #define FLT_MAX_10_EXP_LOG  5 /* = floor(log_2(FLT_MAX_10_EXP)) */
00044 
00045 
00046 /* The array with the number representation. */
00047 extern const mp_limb_t __tens[] attribute_hidden;
00048 
00049 /* Table of powers of ten.  This is used by __printf_fp and by
00050    strtof/strtod/strtold.  */
00051 struct mp_power
00052   {
00053     size_t arrayoff;        /* Offset in `__tens'.  */
00054     mp_size_t arraysize;    /* Size of the array.  */
00055     int p_expo;                    /* Exponent of the number 10^(2^i).  */
00056     int m_expo;                    /* Exponent of the number 10^-(2^i-1).  */
00057   };
00058 extern const struct mp_power _fpioconst_pow10[LDBL_MAX_10_EXP_LOG + 1]
00059      attribute_hidden;
00060 
00061 /* The constants in the array `_fpioconst_pow10' have an offset.  */
00062 #if BITS_PER_MP_LIMB == 32
00063 # define _FPIO_CONST_OFFSET 2
00064 #else
00065 # define _FPIO_CONST_OFFSET 1
00066 #endif
00067 
00068 
00069 #endif /* fpioconst.h */