GCD Function

Returns the greatest common divisor for a set of integers.

Category: Mathematical
Returned data type: DOUBLE

Syntax

Arguments

expression

specifies any valid expression that evaluates to a numeric value.

Requirement At least two arguments are required.
Data type DOUBLE
See <sql-expression>
FedSQL Expressions

Details

The GCD (greatest common divisor) function returns the greatest common divisor of one or more integers. For example, the greatest common divisor for 30 and 42 is 6. The greatest common divisor is also called the highest common factor.

Example

The following statements illustrate the GCD function:
Statements
Results
select gcd(5,15);
5
select gcd(36,45);
9

See Also

Functions:
Last updated: February 23, 2017