Permalink
Browse files

Don't explode on NaN.Int.

Somehow "got lucky" here on Parrot; be explicit for JVM's sake.
  • Loading branch information...
1 parent 1e07ff8 commit b3ee5fbf7881cefdcaf099c4fe0e8f87c65e1a2f @jnthn jnthn committed Jun 30, 2013
Showing with 2 additions and 2 deletions.
  1. +2 −2 src/core/Num.pm
View
4 src/core/Num.pm
@@ -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);
}

0 comments on commit b3ee5fb

Please sign in to comment.