Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Don't explode on NaN.Int.
Somehow "got lucky" here on Parrot; be explicit for JVM's sake.
  • Loading branch information
jnthn committed Jun 30, 2013
1 parent 1e07ff8 commit b3ee5fb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/core/Num.pm
Expand Up @@ -14,8 +14,8 @@ my class Num does Real {
method Bridge(Num:D:) { self }

method Int(Num:D:) {
(self == $Inf || self == -$Inf) ??
fail("Cannot coerce Inf to an Int") !!
nqp::isnanorinf(nqp::unbox_n(self)) ??
fail("Cannot coerce Inf or NaN to an Int") !!
nqp::fromnum_I(nqp::unbox_n(self), Int);
}

Expand Down

0 comments on commit b3ee5fb

Please sign in to comment.