Files
wren/test/number/mod.wren
T
Evan Shaw 513af6df65 Fix precedence of % operator
It previously had the same precedence as + and -.
2015-01-22 09:49:53 +13:00

18 lines
434 B
Plaintext

IO.print(5 % 3) // expect: 2
IO.print(10 % 5) // expect: 0
IO.print(-4 % 3) // expect: -1
IO.print(4 % -3) // expect: 1
IO.print(-4 % -3) // expect: -1
IO.print(-4.2 % 3.1) // expect: -1.1
IO.print(4.2 % -3.1) // expect: 1.1
IO.print(-4.2 % -3.1) // expect: -1.1
// Left associative.
IO.print(13 % 7 % 4) // expect: 2
// Precedence.
IO.print(13 + 1 % 7) // expect: 14
// TODO: Unsupported RHS types.
// TODO: Error on mod by zero.