fpioconst.h 2.5 KB

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