|
of_gcommondenominator
|
|
Full name
|
pfc_n_cst_tmgmultiple.of_gcommondenominator
|
Access
|
public
|
Extend of
|
long
|
Return value
|
long
|
Prototype
|
public function long of_gcommondenominator(long,long)
|
Name
|
Datatype
|
ll_rem
|
long
|
ll_temp
|
long
|
public function long of_gcommondenominator (long al_one, long al_two);//////////////////////////////////////////////////////////////////////////////
//
// Function:
// of_GCommonDenominator
//
// Access:
// protected
//
// Arguments:
// al_one : Long; parameter #1
// al_two : Long; parameter #2
//
// Returns:
// long : the GCD of the two numbers
// -1 : Error
//
// Description:
// Calculates the Greatest Common Denominator of the two values
//
//////////////////////////////////////////////////////////////////////////////
//
// Revision History
//
// Version
// 6.0 Initial version
//
//////////////////////////////////////////////////////////////////////////////
//
// Copyright © 1996-1997 Sybase, Inc. and its subsidiaries. All rights reserved.
// Any distribution of the PowerBuilder Foundation Classes (PFC)
// source code by other than Sybase, Inc. and its subsidiaries is prohibited.
//
//////////////////////////////////////////////////////////////////////////////
long ll_rem
long ll_temp
// Validate the arguments.
If IsNull(al_one) Or IsNull(al_two) Then Return -1
// Make the first parameter the largest
if al_two > al_one then
ll_temp = al_one
al_one = al_two
al_two = ll_temp
end if
// Determine the remainder
ll_rem = Mod(al_one, al_two)
// If it's zero then we are done
if ll_rem = 0 then return al_two
// Use the remainder as input
Return of_GCommonDenominator(al_two, ll_rem)
end function