Skip to content

Modern Math FloorMod

Paul Squires edited this page Oct 14, 2026 · 5 revisions

Home › Math Library › Math Library › FloorMod

FloorMod

Syntax

FloorMod(-7,3)

Examples

#import "std/numeric"
using numeric

'' The remainder with the SIGN OF THE DIVISOR, which is what a wrapping
'' index wants -- unlike MOD, which follows the dividend
dim as int32 a = -1, b = 5
print FloorMod( a, b )       '' 4
print a mod b                '' -1 -- the built-in, for comparison

'' Which makes it the right one for "wrap this index into range"

Library: Math Library
Category: Math Library
Documented under: Nothing Becomes A Keyword

Clone this wiki locally