Logo

Programming-Idioms

History of Idiom 74 > diff from v7 to v8

Edit summary for version 8 by :

Version 7

2015-08-23, 19:46:39

Version 8

2015-08-25, 21:06:54

Idiom #74 Compute GCD

Compute the greatest common divisor x of big integers a and b. Use an integer type able to handle huge numbers.

Idiom #74 Compute GCD

Compute the greatest common divisor x of big integers a and b. Use an integer type able to handle huge numbers.

Imports
import std.numeric: gcd;
Code
x = gcd(a, b);
Comments bubble
This is the standard way to compute gcd, however it doesn't work with std.bigints right now (https://issues.dlang.org/show_bug.cgi?id=7102)
Doc URL
http://dlang.org/phobos/std_numeric.html#.gcd