decQuad.c 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. /* decQuad module for the decNumber C Library.
  2. Copyright (C) 2007-2022 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. /* decQuad.c -- decQuad operations module */
  22. /* ------------------------------------------------------------------ */
  23. /* This module comprises decQuad operations (including conversions) */
  24. /* ------------------------------------------------------------------ */
  25. #include "decContext.h" /* public includes */
  26. #include "decQuad.h" /* .. */
  27. /* Constant mappings for shared code */
  28. #define DECPMAX DECQUAD_Pmax
  29. #define DECEMIN DECQUAD_Emin
  30. #define DECEMAX DECQUAD_Emax
  31. #define DECEMAXD DECQUAD_EmaxD
  32. #define DECBYTES DECQUAD_Bytes
  33. #define DECSTRING DECQUAD_String
  34. #define DECECONL DECQUAD_EconL
  35. #define DECBIAS DECQUAD_Bias
  36. #define DECLETS DECQUAD_Declets
  37. #define DECQTINY (-DECQUAD_Bias)
  38. /* Type and function mappings for shared code */
  39. #define decFloat decQuad /* Type name */
  40. /* Utilities and conversions (binary results, extractors, etc.) */
  41. #define decFloatFromBCD decQuadFromBCD
  42. #define decFloatFromInt32 decQuadFromInt32
  43. #define decFloatFromPacked decQuadFromPacked
  44. #define decFloatFromPackedChecked decQuadFromPackedChecked
  45. #define decFloatFromString decQuadFromString
  46. #define decFloatFromUInt32 decQuadFromUInt32
  47. #define decFloatFromWider decQuadFromWider
  48. #define decFloatGetCoefficient decQuadGetCoefficient
  49. #define decFloatGetExponent decQuadGetExponent
  50. #define decFloatSetCoefficient decQuadSetCoefficient
  51. #define decFloatSetExponent decQuadSetExponent
  52. #define decFloatShow decQuadShow
  53. #define decFloatToBCD decQuadToBCD
  54. #define decFloatToEngString decQuadToEngString
  55. #define decFloatToInt32 decQuadToInt32
  56. #define decFloatToInt32Exact decQuadToInt32Exact
  57. #define decFloatToPacked decQuadToPacked
  58. #define decFloatToString decQuadToString
  59. #define decFloatToUInt32 decQuadToUInt32
  60. #define decFloatToUInt32Exact decQuadToUInt32Exact
  61. #define decFloatToWider decQuadToWider
  62. #define decFloatZero decQuadZero
  63. /* Computational (result is a decFloat) */
  64. #define decFloatAbs decQuadAbs
  65. #define decFloatAdd decQuadAdd
  66. #define decFloatAnd decQuadAnd
  67. #define decFloatDivide decQuadDivide
  68. #define decFloatDivideInteger decQuadDivideInteger
  69. #define decFloatFMA decQuadFMA
  70. #define decFloatInvert decQuadInvert
  71. #define decFloatLogB decQuadLogB
  72. #define decFloatMax decQuadMax
  73. #define decFloatMaxMag decQuadMaxMag
  74. #define decFloatMin decQuadMin
  75. #define decFloatMinMag decQuadMinMag
  76. #define decFloatMinus decQuadMinus
  77. #define decFloatMultiply decQuadMultiply
  78. #define decFloatNextMinus decQuadNextMinus
  79. #define decFloatNextPlus decQuadNextPlus
  80. #define decFloatNextToward decQuadNextToward
  81. #define decFloatOr decQuadOr
  82. #define decFloatPlus decQuadPlus
  83. #define decFloatQuantize decQuadQuantize
  84. #define decFloatReduce decQuadReduce
  85. #define decFloatRemainder decQuadRemainder
  86. #define decFloatRemainderNear decQuadRemainderNear
  87. #define decFloatRotate decQuadRotate
  88. #define decFloatScaleB decQuadScaleB
  89. #define decFloatShift decQuadShift
  90. #define decFloatSubtract decQuadSubtract
  91. #define decFloatToIntegralValue decQuadToIntegralValue
  92. #define decFloatToIntegralExact decQuadToIntegralExact
  93. #define decFloatXor decQuadXor
  94. /* Comparisons */
  95. #define decFloatCompare decQuadCompare
  96. #define decFloatCompareSignal decQuadCompareSignal
  97. #define decFloatCompareTotal decQuadCompareTotal
  98. #define decFloatCompareTotalMag decQuadCompareTotalMag
  99. /* Copies */
  100. #define decFloatCanonical decQuadCanonical
  101. #define decFloatCopy decQuadCopy
  102. #define decFloatCopyAbs decQuadCopyAbs
  103. #define decFloatCopyNegate decQuadCopyNegate
  104. #define decFloatCopySign decQuadCopySign
  105. /* Non-computational */
  106. #define decFloatClass decQuadClass
  107. #define decFloatClassString decQuadClassString
  108. #define decFloatDigits decQuadDigits
  109. #define decFloatIsCanonical decQuadIsCanonical
  110. #define decFloatIsFinite decQuadIsFinite
  111. #define decFloatIsInfinite decQuadIsInfinite
  112. #define decFloatIsInteger decQuadIsInteger
  113. #define decFloatIsNaN decQuadIsNaN
  114. #define decFloatIsNormal decQuadIsNormal
  115. #define decFloatIsSignaling decQuadIsSignaling
  116. #define decFloatIsSignalling decQuadIsSignalling
  117. #define decFloatIsSigned decQuadIsSigned
  118. #define decFloatIsSubnormal decQuadIsSubnormal
  119. #define decFloatIsZero decQuadIsZero
  120. #define decFloatRadix decQuadRadix
  121. #define decFloatSameQuantum decQuadSameQuantum
  122. #define decFloatVersion decQuadVersion
  123. #include "decNumberLocal.h" /* local includes (need DECPMAX) */
  124. #include "decCommon.c" /* non-arithmetic decFloat routines */
  125. #include "decBasic.c" /* basic formats routines */