Skip to content

Commit 8c56c11

Browse files
committed
Only return True on whole numbers, Zoffix++
This is an alternate version of PR #656
1 parent 9441bb2 commit 8c56c11

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/core/Int.pm

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,8 @@ multi sub is-prime(Int:D \i) {
389389
nqp::p6bool(nqp::isprime_I(nqp::decont(i), nqp::unbox_i(100)));
390390
}
391391
multi sub is-prime(\i) {
392-
nqp::p6bool(nqp::isprime_I(nqp::decont(i.Int), nqp::unbox_i(100)));
392+
i == i.floor
393+
&& nqp::p6bool(nqp::isprime_I(nqp::decont(i.Int), nqp::unbox_i(100)));
393394
}
394395

395396
proto sub expmod($, $, $) is pure {*}

0 commit comments

Comments
 (0)