$x.nude
That enables me to see that 1.111111111111111111111.FatRat and 1.111111111111111111111.Rat have equivalent rational values:
> my $x = 1.111111111111111111111.Rat; $x.nude
(1111111111111111111111 1000000000000000000000)
> my $y = 1.111111111111111111111.FatRat; $y.nude
(1111111111111111111111 1000000000000000000000)
and that $x (the Rat) gets handled in a way that I don't really expect:
> my $r1 = $x * 0.3
0.333333333333333
> $r1 = $x * 0.3.Rat
0.333333333333333
> $r1 = $x * 0.3.Num
0.333333333333333
> $r1 = $x * 3e-1
0.333333333333333
> $r1 = $x * 0.3.FatRat
0.3333333333333333333333
though the last result is as I expected.
Compare those outputs with:
> my $r2 = $y * 0.3
0.3333333333333333333333
> my $r2 = $y * 0.3.Rat
0.3333333333333333333333
> my $r2 = $y * 0.3.Num
0.333333333333333
> my $r2 = $y * 3e-1
0.333333333333333
> my $r2 = $y * 0.3.FatRat
0.3333333333333333333333
which is more in keeping with my expectations.
I'm sure it all makes sense if you know how to look at it from the appropriate angle.
Cheers, Rob |