You are here

function greatest_common_divisor in Recipe 6

Same name and namespace in other branches
  1. 7.2 recipe.module \greatest_common_divisor()
  2. 7 recipe.module \greatest_common_divisor()

Find the greatest common divisor

1 call to greatest_common_divisor()
recipe_ingredient_quantity_from_decimal in ./recipe.module
Converts an ingredient's quantity from decimal to fraction

File

./recipe.module, line 1004
recipe.module - share recipes

Code

function greatest_common_divisor($a, $b) {
  while ($b != 0) {
    $remainder = $a % $b;
    $a = $b;
    $b = $remainder;
  }
  return abs($a);
}