Copyright (c) IBM Corporation, 2002.
All rights reserved. ©
|Draft of 5 Jul 2002|
|[previous | contents | next]
describes the testcases included in the testcase package (decTest.zip),
and their history.
The following groups cover the operations of the
||Tests the abs operation.
||Tests the add operation, including both positive and
negative numbers for the operands.
||Tests the base string conversions (toSci and
toEng operations), including strings which are not valid
||Tests the compare operation.
||Tests the divide operation.
||Tests the divideint operation.
||Tests the integer (round-to-integer) operation.
||Tests the max operation.
||Tests the min operation.
||Tests the minus operation.
||Tests the multiply operation.
||Tests the remainder operation.
||Tests the remaindernear (IEEE remainder) operation.
||Tests the rescale operation.
||Tests the subtract operation.
||Tests the trim operation.
The following groups cover more general aspects of the base operations.
||Tests edge cases for the inexact and rounded
conditions, using a selection of operations.
||Tests the power operation (currently under
||4000 randomly-generated tests, using the add,
compare, divide, divideint,
multiply, power, remainder, and
subtract base operations.
||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, and a further three include random
tests for these representations and for boundary conditions around 32 digits:
||Boundary condition tests for the ‘double precision’ decimal data
type (33 digits, maximum exponent +9999).
||2400 tests, as in the randoms group, with precisions 31
through 33 and maximum exponent +9999.
||4000 tests, as in the randoms group, for the ‘double
precision’ decimal data type (33 digits, maximum exponent +9999).
||4000 tests, as in the randoms group, for the ‘single
precision’ decimal data type (15 digits, maximum exponent +999).
||Boundary condition tests for the ‘single precision’ decimal data
type (15 digits, maximum exponent +999).
All the above groups apear twice:
This separation makes it
easier to test the full or subset arithmetics separately.
- 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.
The final testcase simply runs all the testcases described above:
||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.
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.274-1996.
- 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.274-1996 (plus errata,
- for conversions, conditions, and rounding modes, and the precise
definition of result coefficients: the Standard Decimal Arithmetic
- for extended floating-point arithmetic, including subnormal and special
values (but excluding the deviations noted in the Standard Decimal Arithmetic
Specification): ANSI/IEEE standard 854-1987.
Please send suggestions for improvements to the testcases to the author, Mike
[previous | contents | next]