[Issue 12557] New: std.numeric.gcd documentation reports Euler's algorithm, but it uses Euclid's algorithm

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Apr 10 23:42:29 PDT 2014


https://issues.dlang.org/show_bug.cgi?id=12557

          Issue ID: 12557
           Summary: std.numeric.gcd documentation reports Euler's
                    algorithm, but it uses Euclid's algorithm
           Product: D
           Version: unspecified
          Hardware: All
                OS: All
            Status: NEW
          Severity: trivial
          Priority: P1
         Component: Phobos
          Assignee: nobody at puremagic.com
          Reporter: bert at e.co.za

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 )

--


More information about the Digitalmars-d-bugs mailing list