Link Search Menu Expand Document

EuclideanRing.Extra overview

Added in v1.0.0


Table of contents


utils

div

Signature

export declare function div<A>(E: EuclideanRing<A>)

Added in v1.0.0

gcd

Calculates the greatest common divisor of two values using the Euclidean algorithm. The result is always non-negative.

This function is overloaded such that, when a or b is NonZero<A>, the result of gcd(a, b) is Positive<A>, otherwise it is just NonNegative<A>.

Signature

export declare function gcd<A>(T: Ord<A> & EuclideanRing<A>)

Added in v1.0.0

isEven

Signature

export declare function isEven<A>(E: Eq<A> & EuclideanRing<A>): (a: A) => boolean

Added in v1.0.0

isOdd

Signature

export declare function isOdd<A>(E: Eq<A> & EuclideanRing<A>): (a: A) => boolean

Added in v1.0.0

lcm

Calculates the least common multiple of two values. The result is always non-negative. It’s implemented using {@link gcd} internally.

Signature

export declare function lcm<A>(T: Ord<A> & EuclideanRing<A>): (a: A, b: A) => A

Added in v1.0.0