* Add support for float numbers in rem() arguments * Update docs * Rename to prevent name collision in docs * Update docs after rename to NumberArg * Fix parameter types to follow naming convention * Change doc comment description to not refer to floating point * Update docs after NumberArg doc change * Change function to be more condensed * Change to not try to preserve ints * Update docs to use f64 * A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-macos-8-cores) * Trigger CI --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
27 KiB
27 KiB
title, excerpt, layout
title | excerpt | layout |
---|---|---|
rem | Compute the remainder after dividing `num` by `div`. | manual |
Compute the remainder after dividing num
by div
.
If num
is negative, the result will be too.
rem(num: number, divisor: number) -> number
Tags
math
Arguments
Name | Type | Description | Required |
---|---|---|---|
num |
number |
The number which will be divided by divisor . |
Yes |
divisor |
number |
The number which will divide num . |
Yes |
Returns
number
Examples
assertEqual(rem(7, divisor = 4), 3, 0.01, "remainder is 3")
assertEqual(rem(-7, divisor = 4), -3, 0.01, "remainder is -3")
assertEqual(rem(7, divisor = -4), 3, 0.01, "remainder is 3")
assertEqual(rem(6, divisor = 2.5), 1, 0.01, "remainder is 1")
assertEqual(rem(6.5, divisor = 2.5), 1.5, 0.01, "remainder is 1.5")
assertEqual(rem(6.5, divisor = 2), 0.5, 0.01, "remainder is 0.5")