Skip to content

Commit 1c80e87

Browse files
Alexander Taggartstuarthalloway
authored andcommitted
mod no longer errors on large args
Signed-off-by: Stuart Halloway <[email protected]>
1 parent 1f233ad commit 1c80e87

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/clj/clojure/core.clj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3143,7 +3143,7 @@
31433143
:static true}
31443144
[num div]
31453145
(let [m (rem num div)]
3146-
(if (or (zero? m) (pos? (* num div)))
3146+
(if (or (zero? m) (= (pos? num) (pos? div)))
31473147
m
31483148
(+ m div))))
31493149

test/clojure/test_clojure/numbers.clj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,9 @@
285285
; num = 0, div != 0
286286
(mod 0 3) 0 ; (0 / 3) * 3 + (0 mod 3) = 0 * 3 + 0 = 0
287287
(mod 0 -3) 0
288+
289+
; large args
290+
(mod 3216478362187432 432143214) 120355456
288291
)
289292
)
290293

0 commit comments

Comments
 (0)