Merged revisions 65257 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r65257 | mark.dickinson | 2008-07-27 01:39:07 -0500 (Sun, 27 Jul 2008) | 3 lines

  Issue #3449: Update decimal module to use most recent specification
  (v. 1.68) and tests (v. 2.58) from IBM.
........
diff --git a/Lib/test/decimaltestdata/dqQuantize.decTest b/Lib/test/decimaltestdata/dqQuantize.decTest
index 4c3e1ea..b0cb848 100644
--- a/Lib/test/decimaltestdata/dqQuantize.decTest
+++ b/Lib/test/decimaltestdata/dqQuantize.decTest
@@ -1,6 +1,6 @@
 ------------------------------------------------------------------------

 -- dqQuantize.decTest -- decQuad quantize operation                   --

--- Copyright (c) IBM Corporation, 1981, 2007.  All rights reserved.   --

+-- Copyright (c) IBM Corporation, 1981, 2008.  All rights reserved.   --

 ------------------------------------------------------------------------

 -- Please see the document "General Decimal Arithmetic Testcases"     --

 -- at http://www2.hursley.ibm.com/decimal for the description of      --

@@ -17,7 +17,7 @@
 --   IBM UK, PO Box 31, Birmingham Road, Warwick CV34 5JL, UK         --

 --   mfc@uk.ibm.com                                                   --

 ------------------------------------------------------------------------

-version: 2.57

+version: 2.58

 

 -- Most of the tests here assume a "regular pattern", where the

 -- sign and coefficient are +1.

@@ -455,25 +455,38 @@
 dqqua515 quantize  -0E+1 1e-1 -> -0.0

 dqqua516 quantize  -0E+1  1e0 -> -0

 dqqua517 quantize  -0E+1 1e+1 -> -0E+1

+-- #519 here once a problem

+dqqua518 quantize  0    0E-3  -> 0.000

+dqqua519 quantize  0    0E-33 -> 0E-33

+dqqua520 quantize  0.00000000000000000000000000000000   0E-33 -> 0E-33

+dqqua521 quantize  0.000000000000000000000000000000000  0E-33 -> 0E-33

+

+-- Some non-zeros with lots of padding on the right

+dqqua523 quantize   1   0E-33 -> 1.000000000000000000000000000000000

+dqqua524 quantize  12   0E-32 -> 12.00000000000000000000000000000000

+dqqua525 quantize 123   0E-31 -> 123.0000000000000000000000000000000

+dqqua526 quantize 123   0E-32 -> NaN Invalid_operation

+dqqua527 quantize 123.4 0E-31 -> 123.4000000000000000000000000000000

+dqqua528 quantize 123.4 0E-32 -> NaN Invalid_operation

 

 -- Suspicious RHS values

-dqqua520 quantize   1.234    1e359 -> 0E+359 Inexact Rounded

-dqqua521 quantize 123.456    1e359 -> 0E+359 Inexact Rounded

-dqqua522 quantize   1.234    1e359 -> 0E+359 Inexact Rounded

-dqqua523 quantize 123.456    1e359 -> 0E+359 Inexact Rounded

--- next four are "won't fit" overfl

-dqqua526 quantize   1.234   1e-299 -> NaN Invalid_operation

-dqqua527 quantize 123.456   1e-299 -> NaN Invalid_operation

-dqqua528 quantize   1.234   1e-299 -> NaN Invalid_operation

-dqqua529 quantize 123.456   1e-299 -> NaN Invalid_operation

+dqqua530 quantize   1.234    1e359 -> 0E+359 Inexact Rounded

+dqqua531 quantize 123.456    1e359 -> 0E+359 Inexact Rounded

+dqqua532 quantize   1.234    1e359 -> 0E+359 Inexact Rounded

+dqqua533 quantize 123.456    1e359 -> 0E+359 Inexact Rounded

+-- next four are "won't fit" overflows

+dqqua536 quantize   1.234   1e-299 -> NaN Invalid_operation

+dqqua537 quantize 123.456   1e-299 -> NaN Invalid_operation

+dqqua538 quantize   1.234   1e-299 -> NaN Invalid_operation

+dqqua539 quantize 123.456   1e-299 -> NaN Invalid_operation

 

-dqqua532 quantize   1.234E+299    1e299 -> 1E+299    Inexact Rounded

-dqqua533 quantize   1.234E+298    1e299 -> 0E+299    Inexact Rounded

-dqqua534 quantize   1.234         1e299 -> 0E+299    Inexact Rounded

-dqqua537 quantize   0            1e-299 -> 0E-299

+dqqua542 quantize   1.234E+299    1e299 -> 1E+299    Inexact Rounded

+dqqua543 quantize   1.234E+298    1e299 -> 0E+299    Inexact Rounded

+dqqua544 quantize   1.234         1e299 -> 0E+299    Inexact Rounded

+dqqua547 quantize   0            1e-299 -> 0E-299

 -- next two are "won't fit" overflows

-dqqua538 quantize   1.234        1e-299 -> NaN Invalid_operation

-dqqua539 quantize   1.234        1e-300 -> NaN Invalid_operation

+dqqua548 quantize   1.234        1e-299 -> NaN Invalid_operation

+dqqua549 quantize   1.234        1e-300 -> NaN Invalid_operation

 -- [more below]

 

 -- Specials

@@ -587,13 +600,13 @@
 dqqua699 quantize  NaN   -sNaN88  -> -NaN88 Invalid_operation

 

 -- subnormals and underflow

-dqqua710 quantize  1.00E-6143    1e-6143  ->   1E-6143    Rounded

+dqqua710 quantize  1.00E-6143   1e-6143  ->   1E-6143   Rounded

 dqqua711 quantize  0.1E-6143    2e-6144  ->   1E-6144   Subnormal

 dqqua712 quantize  0.10E-6143   3e-6144  ->   1E-6144   Subnormal Rounded

 dqqua713 quantize  0.100E-6143  4e-6144  ->   1E-6144   Subnormal Rounded

 dqqua714 quantize  0.01E-6143   5e-6145  ->   1E-6145   Subnormal

 -- next is rounded to Emin

-dqqua715 quantize  0.999E-6143   1e-6143  ->   1E-6143    Inexact Rounded

+dqqua715 quantize  0.999E-6143  1e-6143  ->   1E-6143   Inexact Rounded

 dqqua716 quantize  0.099E-6143 10e-6144  ->   1E-6144   Inexact Rounded Subnormal

 

 dqqua717 quantize  0.009E-6143  1e-6145  ->   1E-6145   Inexact Rounded Subnormal

@@ -649,10 +662,12 @@
 dqqua769 quantize -0.0001E-6143 1e-6146 ->  -0E-6146     Inexact Rounded

 

 -- More from Fung Lee

-dqqua1021 quantize  8.666666666666000E+6144  1.000000000000000E+6144 ->  8.666666666666000000000000000000000E+6144  Clamped

-dqqua1022 quantize -8.666666666666000E+6144  1.000000000000000E+6144 -> -8.666666666666000000000000000000000E+6144  Clamped

-dqqua1027 quantize 8.666666666666000E+323  1E+31    -> NaN Invalid_operation

-dqqua1030 quantize 8.66666666E+3           1E+3     -> 9E+3 Inexact Rounded

+-- the next four would appear to be in error, but they are misleading (the

+-- operands will be clamped to a lower exponent) and so are omitted

+-- dqqua1021 quantize  8.666666666666000E+6144  1.000000000000000E+6144 ->  8.666666666666000000000000000000000E+6144  Clamped

+-- dqqua1022 quantize -8.666666666666000E+6144  1.000000000000000E+6144 -> -8.666666666666000000000000000000000E+6144  Clamped

+-- dqqua1027 quantize 8.666666666666000E+323  1E+31    -> NaN Invalid_operation

+-- dqqua1030 quantize 8.66666666E+3           1E+3     -> 9E+3 Inexact Rounded

 

 -- Int and uInt32 edge values for testing conversions

 dqqua1040 quantize -2147483646     0 -> -2147483646