Skip to content

Commit

Permalink
Change expectation of non-normalization of ZDRs
Browse files Browse the repository at this point in the history
BDFL's blessing: http://colabti.org/irclogger/irclogger_log/perl6-dev?date=2018-09-21#l248

What follows is a rationalization for the change, although it can be equally
construed as mental gymnastics to justify a direct specification violation.

The test in question specs a tiny portion of the behaviour of
ZDRs (Zero Denominator Rationals), and the spec does not concern itself with
any of the other behaviours. Some of those turned out to be buggy and were
fixed. Others, are still buggy and need fixing. While a certain fix is
possible while maintaing this test in passing state, that fix inflicts a
non-trivial performance penalty on many operations on *all* Rationals.

Therefore, I argue the 6.c spec is wrong to spec the behaviour of ZDRs in
such a sparse manner, without any regard to how an implementation can
meet the goals of this particular test, while maintaining bug-free behaviour
of ZDRs. Ergo, the test is wrong and shall be removed.
  • Loading branch information
zoffixznet committed Sep 23, 2018
1 parent 84974bf commit 3a34299
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions S32-num/rat.t
Expand Up @@ -40,8 +40,8 @@ is(Rat.new(2, 4).nude, (1, 2), "Reduce to simplest form in constructor");
is(Rat.new(39, 33).nude, (13, 11), "Reduce to simplest form in constructor");
is(Rat.new(0, 33).nude, (0, 1), "Reduce to simplest form in constructor");
is(Rat.new(1451234131, 60).nude, (1451234131, 60), "Reduce huge number to simplest form in constructor");
is(Rat.new(1141234123, 0).nude, (1141234123, 0), "Huge over zero stays huge over zero");
is(Rat.new(-7, 0).nude, (-7, 0), "Negative seven over zero stays negative seven over zero");
is(Rat.new(1141234123, 0).nude, (1, 0), "Huge over zero is normalized");
is(Rat.new(-7, 0).nude, (-1, 0), "Negative seven over zero is normalized");
is(Rat.new(0, 0).nude, (0,0), "Zero over zero stays zero over zero");

# Test basic math
Expand Down

0 comments on commit 3a34299

Please sign in to comment.