GreatestCommonDivisor¶
Get greatest common divisor of x and y.
Providing 0 will result in an error.
Example usage:
use "math"
actor Main
new create(env: Env) =>
try
let gcd = GreatestCommonDivisor[I64](10, 20)?
env.out.print(gcd.string())
else
env.out.print("No GCD")
end
primitive val GreatestCommonDivisor
Constructors¶
create¶
new val create()
: GreatestCommonDivisor val^
Returns¶
Public Functions¶
apply[A: Integer[A] val]¶
fun box apply[A: Integer[A] val](
x: A,
y: A)
: A ?
Parameters¶
- x: A
- y: A
Returns¶
- A ?
eq¶
fun box eq(
that: GreatestCommonDivisor val)
: Bool val
Parameters¶
- that: GreatestCommonDivisor val
Returns¶
- Bool val
ne¶
fun box ne(
that: GreatestCommonDivisor val)
: Bool val
Parameters¶
- that: GreatestCommonDivisor val
Returns¶
- Bool val