www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 12557] New: std.numeric.gcd documentation reports Euler's

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 puremagic.com
          Reporter: bert 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 )

--
Apr 10 2014