This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
4rpl:commands:mod [2021/01/20 15:40] – crosslinked mod and mod2 Karsten75 | 4rpl:commands:mod [2025/02/14 14:57] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
~~NOTOC~~ | ~~NOTOC~~ | ||
- | < | + | < |
+ | < | ||
====== mod ====== | ====== mod ====== | ||
Line 7: | Line 8: | ||
===== Description ===== | ===== Description ===== | ||
Perform integer division and returns the value (modulo) of the difference. | Perform integer division and returns the value (modulo) of the difference. | ||
- | |||
- | See [[mod2]] for a different treatment of negative numbers, | ||
===== Examples ===== | ===== Examples ===== | ||
Line 14: | Line 13: | ||
trace(5 3 mod) #prints ' | trace(5 3 mod) #prints ' | ||
</ | </ | ||
+ | |||
+ | <WRAP indent> | ||
+ | ? **Note: | ||
+ | :: For floating-point values, in the case of x % y if x and y are positive finite values. \\ | ||
+ | .. z is the result of x % y and is computed as x – n * y, where n is the largest possible integer that is less than or equal to x / y. | ||
+ | </ | ||
+ | |||
+ | === See Also === | ||
+ | * [[4rpl: | ||
+ | |||
< | < | ||