decDouble.c 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. /* decDouble module for the decNumber C Library.
  2. Copyright (C) 2007-2013 Free Software Foundation, Inc.
  3. Contributed by IBM Corporation. Author Mike Cowlishaw.
  4. This file is part of GCC.
  5. GCC is free software; you can redistribute it and/or modify it under
  6. the terms of the GNU General Public License as published by the Free
  7. Software Foundation; either version 3, or (at your option) any later
  8. version.
  9. GCC is distributed in the hope that it will be useful, but WITHOUT ANY
  10. WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11. FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
  12. for more details.
  13. Under Section 7 of GPL version 3, you are granted additional
  14. permissions described in the GCC Runtime Library Exception, version
  15. 3.1, as published by the Free Software Foundation.
  16. You should have received a copy of the GNU General Public License and
  17. a copy of the GCC Runtime Library Exception along with this program;
  18. see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
  19. <http://www.gnu.org/licenses/>. */
  20. /* ------------------------------------------------------------------ */
  21. /* decDouble.c -- decDouble operations module */
  22. /* ------------------------------------------------------------------ */
  23. /* This module comprises decDouble operations (including conversions) */
  24. /* ------------------------------------------------------------------ */
  25. #include "decContext.h" /* public includes */
  26. #include "decDouble.h" /* .. */
  27. /* Constant mappings for shared code */
  28. #define DECPMAX DECDOUBLE_Pmax
  29. #define DECEMIN DECDOUBLE_Emin
  30. #define DECEMAX DECDOUBLE_Emax
  31. #define DECEMAXD DECDOUBLE_EmaxD
  32. #define DECBYTES DECDOUBLE_Bytes
  33. #define DECSTRING DECDOUBLE_String
  34. #define DECECONL DECDOUBLE_EconL
  35. #define DECBIAS DECDOUBLE_Bias
  36. #define DECLETS DECDOUBLE_Declets
  37. #define DECQTINY (-DECDOUBLE_Bias)
  38. /* parameters of next-wider format */
  39. #define DECWBYTES DECQUAD_Bytes
  40. #define DECWPMAX DECQUAD_Pmax
  41. #define DECWECONL DECQUAD_EconL
  42. #define DECWBIAS DECQUAD_Bias
  43. /* Type and function mappings for shared code */
  44. #define decFloat decDouble /* Type name */
  45. #define decFloatWider decQuad /* Type name */
  46. /* Utilities and conversions (binary results, extractors, etc.) */
  47. #define decFloatFromBCD decDoubleFromBCD
  48. #define decFloatFromInt32 decDoubleFromInt32
  49. #define decFloatFromPacked decDoubleFromPacked
  50. #define decFloatFromPackedChecked decDoubleFromPackedChecked
  51. #define decFloatFromString decDoubleFromString
  52. #define decFloatFromUInt32 decDoubleFromUInt32
  53. #define decFloatFromWider decDoubleFromWider
  54. #define decFloatGetCoefficient decDoubleGetCoefficient
  55. #define decFloatGetExponent decDoubleGetExponent
  56. #define decFloatSetCoefficient decDoubleSetCoefficient
  57. #define decFloatSetExponent decDoubleSetExponent
  58. #define decFloatShow decDoubleShow
  59. #define decFloatToBCD decDoubleToBCD
  60. #define decFloatToEngString decDoubleToEngString
  61. #define decFloatToInt32 decDoubleToInt32
  62. #define decFloatToInt32Exact decDoubleToInt32Exact
  63. #define decFloatToPacked decDoubleToPacked
  64. #define decFloatToString decDoubleToString
  65. #define decFloatToUInt32 decDoubleToUInt32
  66. #define decFloatToUInt32Exact decDoubleToUInt32Exact
  67. #define decFloatToWider decDoubleToWider
  68. #define decFloatZero decDoubleZero
  69. /* Computational (result is a decFloat) */
  70. #define decFloatAbs decDoubleAbs
  71. #define decFloatAdd decDoubleAdd
  72. #define decFloatAnd decDoubleAnd
  73. #define decFloatDivide decDoubleDivide
  74. #define decFloatDivideInteger decDoubleDivideInteger
  75. #define decFloatFMA decDoubleFMA
  76. #define decFloatInvert decDoubleInvert
  77. #define decFloatLogB decDoubleLogB
  78. #define decFloatMax decDoubleMax
  79. #define decFloatMaxMag decDoubleMaxMag
  80. #define decFloatMin decDoubleMin
  81. #define decFloatMinMag decDoubleMinMag
  82. #define decFloatMinus decDoubleMinus
  83. #define decFloatMultiply decDoubleMultiply
  84. #define decFloatNextMinus decDoubleNextMinus
  85. #define decFloatNextPlus decDoubleNextPlus
  86. #define decFloatNextToward decDoubleNextToward
  87. #define decFloatOr decDoubleOr
  88. #define decFloatPlus decDoublePlus
  89. #define decFloatQuantize decDoubleQuantize
  90. #define decFloatReduce decDoubleReduce
  91. #define decFloatRemainder decDoubleRemainder
  92. #define decFloatRemainderNear decDoubleRemainderNear
  93. #define decFloatRotate decDoubleRotate
  94. #define decFloatScaleB decDoubleScaleB
  95. #define decFloatShift decDoubleShift
  96. #define decFloatSubtract decDoubleSubtract
  97. #define decFloatToIntegralValue decDoubleToIntegralValue
  98. #define decFloatToIntegralExact decDoubleToIntegralExact
  99. #define decFloatXor decDoubleXor
  100. /* Comparisons */
  101. #define decFloatCompare decDoubleCompare
  102. #define decFloatCompareSignal decDoubleCompareSignal
  103. #define decFloatCompareTotal decDoubleCompareTotal
  104. #define decFloatCompareTotalMag decDoubleCompareTotalMag
  105. /* Copies */
  106. #define decFloatCanonical decDoubleCanonical
  107. #define decFloatCopy decDoubleCopy
  108. #define decFloatCopyAbs decDoubleCopyAbs
  109. #define decFloatCopyNegate decDoubleCopyNegate
  110. #define decFloatCopySign decDoubleCopySign
  111. /* Non-computational */
  112. #define decFloatClass decDoubleClass
  113. #define decFloatClassString decDoubleClassString
  114. #define decFloatDigits decDoubleDigits
  115. #define decFloatIsCanonical decDoubleIsCanonical
  116. #define decFloatIsFinite decDoubleIsFinite
  117. #define decFloatIsInfinite decDoubleIsInfinite
  118. #define decFloatIsInteger decDoubleIsInteger
  119. #define decFloatIsNaN decDoubleIsNaN
  120. #define decFloatIsNormal decDoubleIsNormal
  121. #define decFloatIsSignaling decDoubleIsSignaling
  122. #define decFloatIsSignalling decDoubleIsSignalling
  123. #define decFloatIsSigned decDoubleIsSigned
  124. #define decFloatIsSubnormal decDoubleIsSubnormal
  125. #define decFloatIsZero decDoubleIsZero
  126. #define decFloatRadix decDoubleRadix
  127. #define decFloatSameQuantum decDoubleSameQuantum
  128. #define decFloatVersion decDoubleVersion
  129. #include "decNumberLocal.h" /* local includes (need DECPMAX) */
  130. #include "decCommon.c" /* non-arithmetic decFloat routines */
  131. #include "decBasic.c" /* basic formats routines */