* NAME: gcd() * DESCRIPTION: compute greatest common denominator */
| 100 | * DESCRIPTION: compute greatest common denominator |
| 101 | */ |
| 102 | static |
| 103 | unsigned long gcd(unsigned long num1, unsigned long num2) |
| 104 | { |
| 105 | unsigned long tmp; |
| 106 | |
| 107 | while (num2) { |
| 108 | tmp = num2; |
| 109 | num2 = num1 % num2; |
| 110 | num1 = tmp; |
| 111 | } |
| 112 | |
| 113 | return num1; |
| 114 | } |
| 115 | |
| 116 | /* |
| 117 | * NAME: reduce_rational() |