GCD (Function)

image\trumpet2.gif Disclaimer

The GCD function returns the greatest common denominator (GCD) of two numbers.

Syntax

GCD(Num1, Num2)

Returns (Double)

The function returns the GCD of two specified numbers.

Parameters

Name

Type

Description

Num1

Numeric

Sets the value of the first number to evaluate.

Num2

Numeric

Sets the value of the second number to evaluate.

Remarks

The GCD of more than two numbers can be calculated by finding the GCD two of the numbers, then find the GCD of that value and another number, and repeating the process as many times as necessary.  

For example, the following formula finds the GCD of 3 numbers:

     GCDxyz = GCD(GCD(x, y), z)

Examples

Displays GCD value of 0.00625 based on the input numbers .003125 and .01.  The print statement formats the output to display 2 integer digits and 6 decimal digits.

Print(GCD(.003125, .01):2:6);