Document explicitly the behaviour of math.gcd with float arguments
This commit is contained in:
parent
0b184f2584
commit
9723e30647
1 changed files with 3 additions and 0 deletions
|
|
@ -352,6 +352,9 @@ proc `^`*[T](x, y: T): T =
|
||||||
|
|
||||||
proc gcd*[T](x, y: T): T =
|
proc gcd*[T](x, y: T): T =
|
||||||
## Computes the greatest common divisor of ``x`` and ``y``.
|
## Computes the greatest common divisor of ``x`` and ``y``.
|
||||||
|
## Note that for floats, the result cannot always be interpreted as
|
||||||
|
## "greatest decimal `z` such that ``z*N == x and z*M == y``
|
||||||
|
## where N and M are positive integers."
|
||||||
var (x,y) = (x,y)
|
var (x,y) = (x,y)
|
||||||
while y != 0:
|
while y != 0:
|
||||||
x = x mod y
|
x = x mod y
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue