# ABL Math Blank Title 126853

Are there ABL Functions for Greatest Common Divisor and the Least Common Multiple?  If so does anyone have the syntax or an example.

Brenda

I don't think there are many languages that provide this functionality but it should be a fairly simple algorithm to write. Use Euclid's algorithm for GCD

function gcd(a, b)

Â Â while b â‰ 0{

Â Â Â Â t := b
Â Â Â Â b := a mod b

Â Â Â Â a := t
}
Â Â return a

Least common multiple
|a * b| / gcd(a,b)

Jose C Gomez
Software Engineer

T: 904.469.1524 mobile

Quis custodiet ipsos custodes?

On Mon, Dec 9, 2013 at 7:00 AM, brenda mohr wrote:

Â
``````<div>

<p>
``````

Are there ABL Functions for Greatest Common Divisor and the Least Common Multiple?Â If so does anyone have the syntax or an example.Â

Â

Brenda

Â

``````</div>

<div style="color:#fff;min-height:0;"></div>
``````

also check if B > A if you aren't handling that before making the call.

`	if (a > b) 	{		t = b;		b = a;		a = t;	}`

---In vantage@yahoogroups.com, <jose@...> wrote:

I don't think there are many languages that provide this functionality but it should be a fairly simple algorithm to write. Use Euclid's algorithm for GCD

function gcd(a, b)

while b â‰ 0{

t := b
b := a mod b

a := t
}
return a

Least common multiple
|a * b| / gcd(a,b)

Jose C Gomez
Software Engineer

T: 904.469.1524 mobile

Quis custodiet ipsos custodes?

On Mon, Dec 9, 2013 at 7:00 AM, brenda mohr wrote:

``````<div>

<p>
``````

Are there ABL Functions for Greatest Common Divisor and the Least Common Multiple?  If so does anyone have the syntax or an example.

Brenda

``````</div>

<div style="color:#fff;min-height:0;"></div>
``````

In Quoting, I use the configurator to calculate the price breaks as well as the costing.  We make sand cores and can use several molds to create the final set.  The price breaks are determined by an hours run, BUT each core box can run at a different rate, so the price breaks can be a little tricky.  FORTRAN was my first languageâ€¦ kinda missing it right now.

Brenda

From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com] On Behalf Of Winter, Patrick
Sent: Monday, December 09, 2013 9:46 AM
To: vantage@yahoogroups.com
Subject: RE: [Vantage] ABL Math

Out of extreme curiosity, what is the application?

In all my years of business systems being a math minded person I have never used GCD or LCM in any business systems work.

Can you teach this old dog a new trick?

Patrick

From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com] On Behalf Of jckinneman@...
Sent: Monday, December 09, 2013 08:16
To: vantage@yahoogroups.com
Subject: Re: [Vantage] ABL Math

also check if B > A if you aren't handling that before making the call.

`        if (a > b)         {               t = b;               b = a;               a = t;        }`

---In vantage@yahoogroups.com, <jose@...> wrote:

I don't think there are many languages that provide this functionality but it should be a fairly simple algorithm to write. Use Euclid's algorithm for GCD

function gcd(a, b)

while b â‰ 0{

t := b

b := a mod b

a := t

}

return a

Least common multiple

|a * b| / gcd(a,b)

Jose C Gomez

Software Engineer

T: 904.469.1524 mobile

Quis custodiet ipsos custodes?

On Mon, Dec 9, 2013 at 7:00 AM, brenda mohr <brenda@...> wrote:

Are there ABL Functions for Greatest Common Divisor and the Least Common Multiple?  If so does anyone have the syntax or an example.

Brenda