#include "gcd.hpp"
Go to the source code of this file.
Functions | |
int | gcd (int n, int m) |
int gcd | ( | int | n, | |
int | m | |||
) |
Compute greatest-common-denominator.
n | ||
m |
Definition at line 3 of file gcd.cpp.
Referenced by rational< T >::reduce().
00004 { 00005 if (n < 0) 00006 n = -n; 00007 while (m != 0) { 00008 int tmp(n % m); 00009 n = m; 00010 m = tmp; 00011 } 00012 return n; 00013 }