Bug 12557 – std.numeric.gcd documentation reports Euler's algorithm, but it uses Euclid's algorithm

Status
RESOLVED
Resolution
FIXED
Severity
trivial
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2014-04-11T06:42:00Z
Last change time
2015-06-09T01:31:19Z
Assigned to
nobody
Creator
bert

Comments

Comment #0 by bert — 2014-04-11T06:42:29Z
The documentation for std.numeric.gcd in http://dlang.org/phobos/std_numeric.html says: "Computes the greatest common divisor of a and b by using Euler's algorithm." but looking at the code (where the comment also obviously comes from to generate the documentation page): https://github.com/D-Programming-Language/phobos/blob/master/std/numeric.d it seems to me to use Euclid's algorithm: http://en.wikipedia.org/wiki/Greatest_common_divisor#Using_Euclid.27s_algorithm I also couldn't really find any references to a formula for greatest common divisor devised by Euler. The fix is thus just to replace Euler with Euclid in the comment of the gcd function. (I "reported" this on twitter too, but it consequently dawned on me that is not the correct route. https://twitter.com/epigamiq/status/454191037742059520 )
Comment #1 by bert — 2014-04-11T06:52:36Z
Of purely academical interest: Euler's formula is "somewhat" more complicated than Euclid's: http://en.wikipedia.org/wiki/Euler's_formula (and has a completely different goal). Also, Euler trod this earth about 2000 years after Euclid.
Comment #2 by github-bugzilla — 2014-05-15T10:23:23Z
Commits pushed to master at https://github.com/D-Programming-Language/phobos https://github.com/D-Programming-Language/phobos/commit/fb5dd753a684ac81aef77d8ed5ae8c2cda9bc355 Trivial documentation fix for issue 12557 gcd is implemented with Euclid's algorithm, not Euler's algorithm. https://issues.dlang.org/show_bug.cgi?id=12557 https://github.com/D-Programming-Language/phobos/commit/aca7906e298fd6ed8914ec6386559eec1c44cab3 Merge pull request #2168 from gyrovague/master Trivial documentation fix for issue 12557