Rework the testing framework for number-theoretic division operators
authorMark H Weaver <mhw@netris.org>
Mon, 31 Jan 2011 05:42:35 +0000 (00:42 -0500)
committerAndy Wingo <wingo@pobox.com>
Mon, 31 Jan 2011 08:51:02 +0000 (09:51 +0100)
commita8591a55f0d7186fbdd58b3c570bbe945b58fa11
treea2c3be7ee4837244e66dd96e0339bf278f835f2f
parent6e0975603eb4e568def1a91f9b127a6a35bdbe44
Rework the testing framework for number-theoretic division operators

* test-suite/tests/numbers.test (test-eqv?): Remove special handling of
  zeroes.  Zeroes are now compared like all other numbers.  Exact
  numbers are compared with `eqv?' and inexact numbers are compared to
  within test-epsilon.

  Rework the testing framework for number-theoretic division operators:
  `euclidean/', `euclidean-quotient', `euclidean-remainder',
  `centered/', `centered-quotient', and `centered-remainder'.
  Previously we compared all test results against a simple scheme
  implementation of the same operations.  However, these operations have
  discontinuous jumps where a tiny change in the inputs can lead to a
  large change in the outputs, e.g.:

    (euclidean/ 130.00000000000 10/7) ==> 91.0 and 0.0
    (euclidean/ 129.99999999999 10/7) ==> 90.0 and 1.42857142856141

  In the new testing scheme, we compare values against the simple
  implementations only if the input arguments contain an infinity or a
  NaN.  In the common case of two finite arguments, we simply make sure
  that the outputs of all three operators (e.g. `euclidean/',
  `euclidean-quotient', `euclidean-remainder') equal each other, that
  outputs are exact iff both inputs are exact, and that the required
  properties of the operator are met: that Q is an integer, that R is
  within the specified range, and that N = Q*D + R.
test-suite/tests/numbers.test