Skip to content

Commit

Permalink
Fix Rational.norm
Browse files Browse the repository at this point in the history
It assumes the Rationals are always reduced, however, that's not the
case for optimization reasons.

Fix by reducing before returning self.

Bug find: https://irclog.perlgeek.de/perl6/2017-02-13#i_14092899
  • Loading branch information
zoffixznet committed Feb 13, 2017
1 parent 9841313 commit aac9efc
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/core/Rational.pm
Expand Up @@ -201,7 +201,7 @@ my role Rational[::NuT, ::DeT] does Real {
self.new($!numerator - $!denominator, $!denominator);
}

method norm() { self }
method norm() { self.REDUCE-ME; self }

method narrow(::?CLASS:D:) {
self.REDUCE-ME;
Expand Down

0 comments on commit aac9efc

Please sign in to comment.