Modulo

com.phasmidsoftware.number.core.inner.Modulo
See theModulo companion object
trait Modulo[X]

Typeclass for types that support modular arithmetic. This provides operations needed to normalize values into a range using modulo.

Type parameters

X

the numeric type

Attributes

Companion
object
Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes

Members list

Value members

Abstract methods

def compare(x: X, y: X): Int

Compare two values. Returns negative if x < y, zero if x == y, positive if x > y.

Compare two values. Returns negative if x < y, zero if x == y, positive if x > y.

Attributes

def minus(x: X, y: X): X

Subtract two values.

Subtract two values.

Attributes

def mod(x: X, m: X): X

Compute the modulo of x with respect to m. The result should always be in the range [0, m) for positive m.

Compute the modulo of x with respect to m. The result should always be in the range [0, m) for positive m.

Value parameters

m

the modulus

x

the value to normalize

Attributes

Returns

x mod m

def plus(x: X, y: X): X

Add two values.

Add two values.

Attributes

def zero: X

The zero value for this numeric type.

The zero value for this numeric type.

Attributes