greatest common divisor - Implementation of the in-built __gcd method in C++ -
Does the built-in __GCD method in the stell-algorithm library use Euclid's algorithm in its implementation?
The source code appears
/ ** * Rotate it Is a helpful function for RAIS special algorithm * It gives the largest common denominator of two integer values * / templates & lt; Typename _EuclideanRingElement & gt; _EuclideanRingElement __gcd (_EuclideanRingElement __m, _EuclideanRingElement __n) {While (__n! = 0) {_EuclideanRingElement __t = __m% __n; __m = __n; __n = __t; } Return __ meter; }
So, it uses Euclidean algorithms.
EDIT: I forgot a little question, this is the implementation in the header for G ++ 4.9.1.
Comments
Post a Comment