Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Simplify RatToStr code, making it closer to TimToady's original.
  • Loading branch information
colomon committed Mar 3, 2013
1 parent 08a736f commit 713c785
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lib/CORE.setting
Expand Up @@ -866,12 +866,12 @@ sub Niecza::RatToStr ($rat, :$all) {
$s ~= $i;
if $r {
$s ~= '.';
my $want = $rat.denominator < 100_000
?? 6
!! $rat.denominator.Str.chars + 1;
my $want = $all ?? Inf
!! $rat.denominator < 100_000
?? 6
!! $rat.denominator.Str.chars + 1;
my $f = '';
my $not-done = $all ?? { True } !! { $f.chars < $want };
while $r and $not-done() {
while $r and $f.chars < $want {
$r *= 10;
$i = $r.floor;
$f ~= $i;
Expand Down

0 comments on commit 713c785

Please sign in to comment.