1
0
mirror of https://github.com/janet-lang/janet synced 2025-10-16 08:17:41 +00:00

Fix #1130 - mod flipped for signed integers.

This commit is contained in:
Calvin Rose
2023-05-11 18:15:37 -05:00
parent 84a4e3e98a
commit 7e65c2bdad
2 changed files with 26 additions and 4 deletions

View File

@@ -261,4 +261,12 @@
(modcheck -10 3)
(modcheck -10 -3)
# Check for issue #1130
(var d (int/s64 7))
(mod 0 d)
(var d (int/s64 7))
(def result (seq [n :in (range -21 0)] (mod n d)))
(assert (deep= result (map int/s64 @[0 1 2 3 4 5 6 0 1 2 3 4 5 6 0 1 2 3 4 5 6])) "issue #1130")
(end-suite)