GreatestCommonDivisor¶
Get greatest common divisor of x and y.
Errors when either argument is zero or when the result cannot be
represented (e.g. gcd(I8.min_value(), I8.min_value())).
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
Constructors¶
create¶
Returns¶
Public Functions¶
apply[A: Integer[A] val]¶
Returns the greatest common divisor of x and y. Errors if
either is zero or if the result cannot be represented in A.
Parameters¶
- x: A
- y: A
Returns¶
- A ?
eq¶
Parameters¶
- that: GreatestCommonDivisor val
Returns¶
- Bool val
ne¶
Parameters¶
- that: GreatestCommonDivisor val
Returns¶
- Bool val