Wed Jul 17 10:54:20 1996 David Mosberger-Tang <davidm@azstarnet.com>
[glibc/history.git] / stdlib / fpioconst.h
blob110fc8b86a2b46a4e76ee37ce59a5ffd14419368
1 /* Header file for constants used in floating point <-> decimal conversions.
2 Copyright (C) 1995, 1996 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public License as
7 published by the Free Software Foundation; either version 2 of the
8 License, or (at your option) any later version.
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
13 Library General Public License for more details.
15 You should have received a copy of the GNU Library General Public
16 License along with the GNU C Library; see the file COPYING.LIB. If
17 not, write to the Free Software Foundation, Inc., 675 Mass Ave,
18 Cambridge, MA 02139, USA. */
20 #ifndef _FPIOCONST_H
21 #define _FPIOCONST_H
23 #include <float.h>
24 #include "gmp.h"
27 /* These values are used by __printf_fp, where they are noncritical (if the
28 value is not large enough, it will just be slower); and by
29 strtof/strtod/strtold, where it is critical (it's used for overflow
30 detection).
32 XXX These should be defined in <float.h>. For the time being, we have the
33 IEEE754 values here. */
35 #define LDBL_MAX_10_EXP_LOG 12 /* = floor(log_2(LDBL_MAX_10_EXP)) */
36 #define DBL_MAX_10_EXP_LOG 8 /* = floor(log_2(DBL_MAX_10_EXP)) */
37 #define FLT_MAX_10_EXP_LOG 5 /* = floor(log_2(FLT_MAX_10_EXP)) */
40 /* Table of powers of ten. This is used by __printf_fp and by
41 strtof/strtod/strtold. */
42 struct mp_power
44 const mp_limb_t *array; /* The array with the number representation. */
45 mp_size_t arraysize; /* Size of the array. */
46 int p_expo; /* Exponent of the number 10^(2^i). */
47 int m_expo; /* Exponent of the number 10^-(2^i-1). */
49 extern const struct mp_power _fpioconst_pow10[LDBL_MAX_10_EXP_LOG + 1];
51 /* The constants in the array `_fpioconst_pow10' have an offset. */
52 #if BITS_PER_MP_LIMB == 32
53 # define _FPIO_CONST_OFFSET 2
54 #else
55 # define _FPIO_CONST_OFFSET 1
56 #endif
59 #endif /* fpioconst.h */