dqAbs.decTest 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. ------------------------------------------------------------------------
  2. -- dqAbs.decTest -- decQuad absolute value, heeding sNaN --
  3. -- Copyright (c) IBM Corporation, 1981, 2008. All rights reserved. --
  4. ------------------------------------------------------------------------
  5. -- Please see the document "General Decimal Arithmetic Testcases" --
  6. -- at http://www2.hursley.ibm.com/decimal for the description of --
  7. -- these testcases. --
  8. -- --
  9. -- These testcases are experimental ('beta' versions), and they --
  10. -- may contain errors. They are offered on an as-is basis. In --
  11. -- particular, achieving the same results as the tests here is not --
  12. -- a guarantee that an implementation complies with any Standard --
  13. -- or specification. The tests are not exhaustive. --
  14. -- --
  15. -- Please send comments, suggestions, and corrections to the author: --
  16. -- Mike Cowlishaw, IBM Fellow --
  17. -- IBM UK, PO Box 31, Birmingham Road, Warwick CV34 5JL, UK --
  18. -- mfc@uk.ibm.com --
  19. ------------------------------------------------------------------------
  20. version: 2.59
  21. extended: 1
  22. clamp: 1
  23. precision: 34
  24. maxExponent: 6144
  25. minExponent: -6143
  26. rounding: half_even
  27. dqabs001 abs '1' -> '1'
  28. dqabs002 abs '-1' -> '1'
  29. dqabs003 abs '1.00' -> '1.00'
  30. dqabs004 abs '-1.00' -> '1.00'
  31. dqabs005 abs '0' -> '0'
  32. dqabs006 abs '0.00' -> '0.00'
  33. dqabs007 abs '00.0' -> '0.0'
  34. dqabs008 abs '00.00' -> '0.00'
  35. dqabs009 abs '00' -> '0'
  36. dqabs010 abs '-2' -> '2'
  37. dqabs011 abs '2' -> '2'
  38. dqabs012 abs '-2.00' -> '2.00'
  39. dqabs013 abs '2.00' -> '2.00'
  40. dqabs014 abs '-0' -> '0'
  41. dqabs015 abs '-0.00' -> '0.00'
  42. dqabs016 abs '-00.0' -> '0.0'
  43. dqabs017 abs '-00.00' -> '0.00'
  44. dqabs018 abs '-00' -> '0'
  45. dqabs020 abs '-2000000' -> '2000000'
  46. dqabs021 abs '2000000' -> '2000000'
  47. dqabs030 abs '+0.1' -> '0.1'
  48. dqabs031 abs '-0.1' -> '0.1'
  49. dqabs032 abs '+0.01' -> '0.01'
  50. dqabs033 abs '-0.01' -> '0.01'
  51. dqabs034 abs '+0.001' -> '0.001'
  52. dqabs035 abs '-0.001' -> '0.001'
  53. dqabs036 abs '+0.000001' -> '0.000001'
  54. dqabs037 abs '-0.000001' -> '0.000001'
  55. dqabs038 abs '+0.000000000001' -> '1E-12'
  56. dqabs039 abs '-0.000000000001' -> '1E-12'
  57. -- examples from decArith
  58. dqabs040 abs '2.1' -> '2.1'
  59. dqabs041 abs '-100' -> '100'
  60. dqabs042 abs '101.5' -> '101.5'
  61. dqabs043 abs '-101.5' -> '101.5'
  62. -- more fixed, potential LHS swaps/overlays if done by subtract 0
  63. dqabs060 abs '-56267E-10' -> '0.0000056267'
  64. dqabs061 abs '-56267E-5' -> '0.56267'
  65. dqabs062 abs '-56267E-2' -> '562.67'
  66. dqabs063 abs '-56267E-1' -> '5626.7'
  67. dqabs065 abs '-56267E-0' -> '56267'
  68. -- subnormals and underflow
  69. -- long operand tests
  70. dqabs321 abs 1234567890123456 -> 1234567890123456
  71. dqabs322 abs 12345678000 -> 12345678000
  72. dqabs323 abs 1234567800 -> 1234567800
  73. dqabs324 abs 1234567890 -> 1234567890
  74. dqabs325 abs 1234567891 -> 1234567891
  75. dqabs326 abs 12345678901 -> 12345678901
  76. dqabs327 abs 1234567896 -> 1234567896
  77. -- zeros
  78. dqabs111 abs 0 -> 0
  79. dqabs112 abs -0 -> 0
  80. dqabs113 abs 0E+6 -> 0E+6
  81. dqabs114 abs -0E+6 -> 0E+6
  82. dqabs115 abs 0.0000 -> 0.0000
  83. dqabs116 abs -0.0000 -> 0.0000
  84. dqabs117 abs 0E-141 -> 0E-141
  85. dqabs118 abs -0E-141 -> 0E-141
  86. -- full coefficients, alternating bits
  87. dqabs121 abs 2682682682682682682682682682682682 -> 2682682682682682682682682682682682
  88. dqabs122 abs -2682682682682682682682682682682682 -> 2682682682682682682682682682682682
  89. dqabs123 abs 1341341341341341341341341341341341 -> 1341341341341341341341341341341341
  90. dqabs124 abs -1341341341341341341341341341341341 -> 1341341341341341341341341341341341
  91. -- Nmax, Nmin, Ntiny
  92. dqabs131 abs 9.999999999999999999999999999999999E+6144 -> 9.999999999999999999999999999999999E+6144
  93. dqabs132 abs 1E-6143 -> 1E-6143
  94. dqabs133 abs 1.000000000000000000000000000000000E-6143 -> 1.000000000000000000000000000000000E-6143
  95. dqabs134 abs 1E-6176 -> 1E-6176 Subnormal
  96. dqabs135 abs -1E-6176 -> 1E-6176 Subnormal
  97. dqabs136 abs -1.000000000000000000000000000000000E-6143 -> 1.000000000000000000000000000000000E-6143
  98. dqabs137 abs -1E-6143 -> 1E-6143
  99. dqabs138 abs -9.999999999999999999999999999999999E+6144 -> 9.999999999999999999999999999999999E+6144
  100. -- specials
  101. dqabs520 abs 'Inf' -> 'Infinity'
  102. dqabs521 abs '-Inf' -> 'Infinity'
  103. dqabs522 abs NaN -> NaN
  104. dqabs523 abs sNaN -> NaN Invalid_operation
  105. dqabs524 abs NaN22 -> NaN22
  106. dqabs525 abs sNaN33 -> NaN33 Invalid_operation
  107. dqabs526 abs -NaN22 -> -NaN22
  108. dqabs527 abs -sNaN33 -> -NaN33 Invalid_operation
  109. -- Null tests
  110. dqabs900 abs # -> NaN Invalid_operation