[back] [prev] [next] [index] [root]

 


IntGcd

Returns the non-negative greatest common divisor of two integers.

Syntax:

gcd := IntGcd (a1,a2);

integer
  gcd  
integer
  a1  
integer
  a2  

See also:  IntXGcd, IntLcm

Description:

IntGcd(a,0) or IntGcd(0,a) is the absolute value of a. IntGcd(0,0) is 0.


Example:


kash> IntGcd(9, 0);
9
kash> IntGcd(-9, 0);
9
kash> IntGcd(0, 7);
7
kash> IntGcd(0, -7);
7
kash> IntGcd(2345, -505);
5
kash> IntGcd(2345, 505);
> 5


<- back[back] [prev] [next] [index] [root]