Decimal Testcases Copyright (c) IBM Corporation, 2002.
All rights reserved. © 
Draft of 5 Jul 2002 
[previous  contents  next]

This section
describes the testcases included in the testcase package (decTest.zip),
and their history.
The following groups cover the operations of the
specification.
Group 
Description 
abs 
Tests the abs operation. 
add 
Tests the add operation, including both positive and
negative numbers for the operands. 
base 
Tests the base string conversions (toSci and
toEng operations), including strings which are not valid
numbers. 
compare 
Tests the compare operation. 
divide 
Tests the divide operation. 
divideint 
Tests the divideint operation. 
integer 
Tests the integer (roundtointeger) operation. 
max 
Tests the max operation. 
min 
Tests the min operation. 
minus 
Tests the minus operation. 
multiply 
Tests the multiply operation. 
remainder 
Tests the remainder operation. 
remaindernear 
Tests the remaindernear (IEEE remainder) operation. 
rescale 
Tests the rescale operation. 
subtract 
Tests the subtract operation. 
trim 
Tests the trim operation.
 
The following groups cover more general aspects of the base operations.
Group 
Description 
inexact 
Tests edge cases for the inexact and rounded
conditions, using a selection of operations. 
power 
Tests the power operation (currently under
review). 
randoms 
4000 randomlygenerated tests, using the add,
compare, divide, divideint,
multiply, power, remainder, and
subtract base operations. 
rounding 
Tests the different rounding modes. Each rounding mode is
tested for each of the major operations.
 
Two testcase groups are designed for testing the boundary conditions
associated with the proposed concrete representations described in the
Standard Decimal Arithmetic Encoding document,^{[1]} and a further three include random
tests for these representations and for boundary conditions around 32 digits:
Group 
Description 
double 
Boundary condition tests for the ‘double precision’ decimal data
type (33 digits, maximum exponent +9999). 
randomBound32 
2400 tests, as in the randoms group, with precisions 31
through 33 and maximum exponent +9999. 
randomDouble 
4000 tests, as in the randoms group, for the ‘double
precision’ decimal data type (33 digits, maximum exponent +9999).

randomSingle 
4000 tests, as in the randoms group, for the ‘single
precision’ decimal data type (15 digits, maximum exponent +999). 
single 
Boundary condition tests for the ‘single precision’ decimal data
type (15 digits, maximum exponent +999).
 
All the above groups apear twice:
 once with the name as shown above – in these groups the extended
directive is set to 1
 once with the name as shown above with the suffix 0 – in these groups the
extended directive is set to 0.
This separation makes it
easier to test the full or subset arithmetics separately.
The final testcase simply runs all the testcases described above:
Group 
Description 
testall 
Runs all the testcases described above (about 40,100 tests).
 
Coverage of these testcases is (of course) not exhaustive. Instead, the
testcases assure the basic operations of the arithmetic and concentrate on
‘difficult cases’; those tests where the result may not be immediately obvious,
or where some implementation in the past has shown a problem.
The
tests in the testcase groups are derived from a number of sources, and are
intended to cover the paths and edge cases found in:
 Testcases and examples used by the X3 (now NCITS) J18 committee (1991+)
which developed the ANSI standard X3.2741996.^{[2]}
 IBM VM/CMS S/370 Rexx implementation testcases (1981+)
 IBM Vienna Laboratory Rexx compiler testcases (1988+)
 NetRexx testcases (1996+)
 DiagBigDecimal – the open source testcases for the
com.ibm.math.BigDecimal Java class (1997+)
 New testcases, e.g., for the typical concrete representations' edge
cases, for extended values and operations, and the random tests.
The authoritative sources for how the underlying operations should work are:
 for base decimal arithmetic: ANSI X3.2741996 (plus errata,
1997–2001)^{[3]}
 for conversions, conditions, and rounding modes, and the precise
definition of result coefficients: the Standard Decimal Arithmetic
Specification.^{[4]}
 for extended floatingpoint arithmetic, including subnormal and special
values (but excluding the deviations noted in the Standard Decimal Arithmetic
Specification): ANSI/IEEE standard 8541987.^{[5]}
Please send suggestions for improvements to the testcases to the author, Mike
Cowlishaw (mfc@uk.ibm.com).
Footnotes:
[previous  contents  next]