divisor? ( m n -- ? ) (original) (raw)

divisor? ( m n -- ? )
Factor handbook » The language » Numbers » Mathematical functions » Integer functions

Prev: odd? ( n -- ? )
Next: integer-log2 ( x -- n )

Vocabulary
math.functions

Inputs

m an integer
n an integer

Outputs

? a boolean

Word description
Tests if n is a divisor of m. This is the same thing as asking if m is divisible by n.

Notes
Returns t for both negative and positive divisors, as well as for trivial and non-trivial divisors.

Definition

USING: math ;

IN: math.functions

: divisor? ( m n -- ? ) mod zero? ; inline