nitlanguage
/
nit.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
ae0334b
)
fix Int::is_prime
author
Jean Privat
<jean@pryen.org>
Wed, 2 Mar 2016 20:24:38 +0000
(15:24 -0500)
committer
Jean Privat
<jean@pryen.org>
Wed, 2 Mar 2016 20:24:38 +0000
(15:24 -0500)
Signed-off-by: Jean Privat <jean@pryen.org>
lib/core/math.nit
patch
|
blob
|
history
diff --git
a/lib/core/math.nit
b/lib/core/math.nit
index
36cf3fe
..
0f8325f
100644
(file)
--- a/
lib/core/math.nit
+++ b/
lib/core/math.nit
@@
-128,7
+128,7
@@
redef class Int
#
# assert 3.is_prime
# assert not 1.is_prime
- # assert not 12.is_prime
+ # assert not 15.is_prime
fun is_prime: Bool
do
if self == 2 then
@@
-136,7
+136,7
@@
redef class Int
else if self <= 1 or self.is_even then
return false
end
- for i in [3..self.sqrt[ do
+ for i in [3..self.sqrt] do
if self % i == 0 then return false
end
return true