pub fn rem_as_percent(dividend: i64, divisor: i64) -> VMResult<i64>
Expand description
Usage: (% int int)
Remainder from dividing (arg 1) by (arg 2).
Note: Remainder and Modulo are two similar mathematical operations,
called rem
and rem_euclid
in Rust.
This function uses rem
which is the same as the %
operator in C.
With rem
, the sign of the result is the same as the dividend (arg 1).
With rem_euclid
, the sign of the result is always positive.
Section: math
Example: (test::assert-equal 0 (% 50 10)) (test::assert-equal 5 (% 55 10)) (test::assert-equal 1 (% 1 2)) (test::assert-equal -1 (% -10 3)) (test::assert-equal 1 (% 10 -3)) (test::assert-equal -1 (% -10 -3))
(test::assert-error (%)) (test::assert-error (% 1)) (test::assert-error (% 1 2 3)) (test::assert-error (% 1 2.0))