Structural Informatics Group (SIG) logo
Home | Projects | Demos | Downloads | Publications | Local Info | About Us | New site
Go to the first, previous, next, last section, table of contents.

gcd

gcd

type: function (subr)
location: built-in
source file: xlmath.c
Common LISP compatible: yes
supported on: all machines

SYNTAX

(gcd [ <int> ... ] )
        <int>           -       an integer expression

DESCRIPTION

The GCD function returns the greatest common divisor of a series of integers. If no arguments are given, a zero is returned. If only one argument is given, the absolute value of the argument is returned. The successful result is always a positive integer.

EXAMPLES

(gcd 51 34)                             ; returns 17
(gcd 99 66 22)                          ; returns 11
(gcd -99 66 -33)                        ; returns 33
(gcd -14)                               ; returns 14
(gcd 0)                                 ; returns 0
(gcd)                                   ; returns 0
(gcd .2)                                ; error: bad argument type - 0.2


Go to the first, previous, next, last section, table of contents.