comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » gcf
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
gcf [message #9608] Thu, 24 July 1997 00:00
kevb is currently offline  kevb
Messages: 1
Registered: July 1997
Junior Member
Here is a simple function to calculate the GCF of two numbers.
LCM can easily be derived as LCM = val1 * val2 / GCF(val1, val2).

This could be made more efficient, but it works.

============================================================ =
function gcf, val1, val2

fact=val1 mod val2
while fact ne 0 do begin

val1 = val2
val2 = fact
fact = val1 mod val2
endwhile
return , val2
end
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Wow. exp() difficulties...
Next Topic: how to do bitwise operation in IDL???

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 17:58:25 PDT 2025

Total time taken to generate the page: 0.00465 seconds