Skip to content

Commit

Permalink
Unspec zero-denominator Rationals leaving numerator untouched
Browse files Browse the repository at this point in the history
This test was added earlier today and is not part of 6.c spec.

There are some math issues and we might want to solve them by normalizing
newly-created zero-denomiator Rationals into <-1 0 1> numerators:
R#1354 rakudo/rakudo#1354
  • Loading branch information
zoffixznet committed Dec 31, 2017
1 parent 9b69d97 commit 86bf39f
Showing 1 changed file with 1 addition and 21 deletions.
22 changes: 1 addition & 21 deletions S32-num/rat.t
Expand Up @@ -3,7 +3,7 @@ use lib <t/spec/packages>;
use Test;
use Test::Util;

plan 850;
plan 849;

# Basic test functions specific to rational numbers.

Expand Down Expand Up @@ -189,26 +189,6 @@ subtest '±Inf/NaN ⇿ Rat' => {
}
}

subtest 'Zero-denominator Rationals leave numerator at its original value' => {
plan 12;

is-deeply <0/0>.nude, (0, 0), 'NaN-y Rat literal';
is-deeply <42/0>.nude, (42, 0), 'Inf-y Rat literal';
is-deeply <-4/0>.nude, (-4, 0), '-Inf-y Rat literal';

is-deeply (0/0).nude, (0, 0), 'NaN-y Rat /-calculation';
is-deeply (42/0).nude, (42, 0), 'Inf-y Rat /-calculation';
is-deeply (-4/0).nude, (-4, 0), '-Inf-y Rat /-calculation';

is-deeply Rat.new(0, 0).nude, (0, 0), 'NaN-y Rat.new';
is-deeply Rat.new(42, 0).nude, (42, 0), 'Inf-y Rat.new';
is-deeply Rat.new(-4, 0).nude, (-4, 0), '-Inf-y Rat.new';

is-deeply FatRat.new(0, 0).nude, (0, 0), 'NaN-y FatRat.new';
is-deeply FatRat.new(42, 0).nude, (42, 0), 'Inf-y FatRat.new';
is-deeply FatRat.new(-4, 0).nude, (-4, 0), '-Inf-y FatRat.new';
}

# RT #74648
throws-like { Inf.Int / 1 }, X::Numeric::CannotConvert, 'Inf.Int / 1 throws';

Expand Down

0 comments on commit 86bf39f

Please sign in to comment.