Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

NaN.Rat -> NaN

RT #77820
  • Loading branch information...
commit a503510b1e6b4ac70b1476d3326f13389117f3c9 1 parent 58f5ae6
@coke coke authored
Showing with 4 additions and 0 deletions.
  1. +4 −0 src/core/Num.pm
View
4 src/core/Num.pm
@@ -30,6 +30,10 @@ my class Num does Real {
}
method Rat(Num:D: Real $epsilon = 1.0e-6, :$fat) {
+ if nqp::isnanorinf(nqp::unbox_n(self)) {
+ return self;
+ }
+
my sub modf($num) { my $q = $num.Int; $num - $q, $q; }
(self == $Inf || self == -$Inf) && fail("Cannot coerce Inf to a Rat");
Please sign in to comment.
Something went wrong with that request. Please try again.