]>
code.delx.au - gnu-emacs-elpa/blob - packages/realgud/test/gcd.sh
497f33bc1032a8d6e09c5e443903dbd90c0548bc
2 # Greatest Common Divisor in POSIX shell using Euclid's algorithm. On
3 # return, variable gcd_value is set and is the gcd of parameters $1
4 # and $2. The GCD of a negative number is the same as the GCD of its
5 # absolute value, since a negative number is -1 times its positive
6 # value. Negative numbers are set when there is an error; -1 is set
7 # when the wrong number of parameters are given.
15 if (( a
== 1 ||
(b-a
) == 0)) ; then