comp.lang.ada
 help / color / mirror / Atom feed
* source code for lcm or gcd
@ 2002-04-26 19:55 Terry Westley
  2002-04-27  9:03 ` Gautier
  0 siblings, 1 reply; 2+ messages in thread
From: Terry Westley @ 2002-04-26 19:55 UTC (permalink / raw)


Does anyone know of Ada source code for least common multiple or greatest
common divisor?  If you've got source code for gcd, that's great, since
lcm (a, b) = (a * b) / gcd (a, b).

My real goal is to compute the lcm for N integers to spread processing
over multiple frames in a real-time system.

I know that lcm isn't hard using say Euclid's method, but it's even easier if someone
else has already coded and tested it.  If you've got aunit test cases too, you'll get my
nomination for attaboy of the day.

I've checked in "Ada & Software Engineering Library" on CD and www.adapower.com
to no avail.

(This isn't for homework, though I often do my work at home :-)

--
Terry Westley
westley@yahoo.com






^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: source code for lcm or gcd
  2002-04-26 19:55 source code for lcm or gcd Terry Westley
@ 2002-04-27  9:03 ` Gautier
  0 siblings, 0 replies; 2+ messages in thread
From: Gautier @ 2002-04-27  9:03 UTC (permalink / raw)


> Does anyone know of Ada source code for least common multiple or greatest
> common divisor?  If you've got source code for gcd, that's great, since
> lcm (a, b) = (a * b) / gcd (a, b).

You may be interested by the generic GCD in Euclidean_Ring_Tools
(biblio/eurintoo.ad*) of mathpaqs.zip on the page below.
There are 3 or more applications, one using long_long_integer
(tests/test_ert.adb), one with multi-precision integers
(tests/test_rsa.adb) and one with polynomials (tests/teflopol.adb)

HTH
________________________________________________________
Gautier  --  http://www.mysunrise.ch/users/gdm/gsoft.htm

NB: For a direct answer, address on the Web site!



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2002-04-27  9:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-04-26 19:55 source code for lcm or gcd Terry Westley
2002-04-27  9:03 ` Gautier

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox