Overview
- Object ID : 2647 (2013-11-16)
- Author : MarkT | added by Archiver
- Content : Code
- Microcontroller : Propeller 1
- Languages : PASM, SPIN
- Category : Display
- Licence : Other
- Tag : SPI
Content
724:"
This is a simple little method that returns the lowest common multiple of two numbers. For example, if I were to pass it the parameters (12,15), it would return 60. I use it as part of a CNC controller. It can only handle positive numbers.
PUB Get_LCM (m,n) : result | a,b 'Returns lowest common multiple of two numbers
a := m
b := n
repeat while a <> b
if a < b
a := (a+m)
else
b := (b+n)
result := a