gcd Interface

public interface gcd

Returns the greatest common divisor of two integers (Specification)

Version: experimental


Module Procedures

private elemental function gcd_int8(a, b) result(res)

Returns the greatest common divisor of two integers of kind int8 using the Euclidean algorithm.

Arguments

Type IntentOptional Attributes Name
integer(kind=int8), intent(in) :: a
integer(kind=int8), intent(in) :: b

Return Value integer(kind=int8)

private elemental function gcd_int16(a, b) result(res)

Returns the greatest common divisor of two integers of kind int16 using the Euclidean algorithm.

Arguments

Type IntentOptional Attributes Name
integer(kind=int16), intent(in) :: a
integer(kind=int16), intent(in) :: b

Return Value integer(kind=int16)

private elemental function gcd_int32(a, b) result(res)

Returns the greatest common divisor of two integers of kind int32 using the Euclidean algorithm.

Arguments

Type IntentOptional Attributes Name
integer(kind=int32), intent(in) :: a
integer(kind=int32), intent(in) :: b

Return Value integer(kind=int32)

private elemental function gcd_int64(a, b) result(res)

Returns the greatest common divisor of two integers of kind int64 using the Euclidean algorithm.

Arguments

Type IntentOptional Attributes Name
integer(kind=int64), intent(in) :: a
integer(kind=int64), intent(in) :: b

Return Value integer(kind=int64)