Permalink
Browse files

Make Num.perl about up to 2.4x as fast

  • Loading branch information...
lizmat committed May 2, 2016
1 parent 631a36c commit 949a7c7ab4964c57b413eb22a13babb60087f694
Showing with 6 additions and 8 deletions.
  1. +6 −8 src/core/Num.pm
@@ -27,14 +27,12 @@ my class Num does Real { # declared in BOOTSTRAP
multi method new($n) { nqp::box_n($n.Num, self) }

multi method perl(Num:D:) {
my $res = self.Str;
if nqp::isnanorinf(nqp::unbox_n(self))
|| $res.index('e').defined
|| $res.index('E').defined {
$res;
} else {
$res ~ 'e0';
}
my str $res = self.Str;
nqp::isnanorinf(nqp::unbox_n(self))
|| nqp::isge_i(nqp::index($res,'e'),0)
|| nqp::isge_i(nqp::index($res,'E'),0)
?? $res
!! nqp::concat($res,'e0')
}

method Rat(Num:D: Real $epsilon = 1.0e-6, :$fat) {

0 comments on commit 949a7c7

Please sign in to comment.