Skip to content

Modern Math GCD

Paul Squires edited this page Oct 19, 2026 · 5 revisions

Home › Math Library › Math Library › GCD

GCD

Returns the greatest common divisor of two whole numbers.

Syntax

GCD( a, b )

Examples

#import "std/numeric"
using numeric

dim as int32 a = 12, b = 18
print GCD( a, b )            '' 6

'' GCD with zero is the other operand, which is the identity that makes
'' a fold over a list work with no special first case
dim as int32 z = 0
print GCD( a, z )            '' 12

Library: Math Library
Category: Math Library
Documented under: Nothing Becomes A Keyword

Clone this wiki locally