Merge pull request #2705 from borisvassilev/gcddocs
Document explicitly the behaviour of math.gcd with float arguments
This commit is contained in:
commit
2dee0324f3
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 =
|
||||
## 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)
|
||||
while y != 0:
|
||||
x = x mod y
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue