# New Ticket Created by  Michael Schaap 
# Please include the string:  [perl #130774]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org/Ticket/Display.html?id=130774 >


It's fairly rare to encounter a Rat that isn't normalized, but if you do 
get one, norm() doesn't normalize the numerator/denominator.
nude() does, though, and actually changes the Rat (which is supposed to 
be immutable).

Example:

 > my $f = 1/13² + 1/26² + 1/39² + 1/78²
0.008218
 > say $f.numerator, '/', $f.denominator;
50/6084
 > my $g = $f.norm;
0.008218
 > say $g.numerator, '/', $g.denominator;
50/6084
 > say $f.nude.join('/');
25/3042
 > say $f.numerator, '/', $f.denominator;
25/3042
 > say $g.numerator, '/', $g.denominator;
25/3042

Even stranger, $g is now normalized as well.

This is on Rakudo Star 2017.01, 64-bit Linux.

% perl6 --version
This is Rakudo version 2017.01 built on MoarVM version 2017.01
implementing Perl 6.c.

Reply via email to