From: Roy C. Crisman

on isEvenlyDivisible thisNumber, thisDivisor
  if voidP(thisDivisor) then
    thisDivisor = 2
  end if
  thisNumber = float(thisNumber) / thisDivisor

  repeat while (thisNumber > the maxInteger)
    thisNumber = thisNumber - the maxInteger
  end repeat

  return (thisNumber = integer(thisNumber))
end

put isEvenlyDivisible(5.0 + the maxInteger,5)
--0
put isEvenlyDivisible(5.0 + the maxInteger,4)
--1
put isEvenlyDivisible(5.0 + the maxInteger,3)
--1
put isEvenlyDivisible(5.0 + the maxInteger,2)
--1

this'll not only tell you if the number is even.

Divide first, then remove something integer-like from the result until it'll fit
in the maxinteger to see if it has a decimal bit.

(the fact that maxInteger + 5 IS evenly divisible by 2, 3, and 4 made me triple
check my results...I grabbed 5 completely out of the air!)
roymeo



[To remove yourself from this list, or to change to digest mode, go to
http://www.penworks.com/LUJ/lingo-l.cgi  To post messages to the list,
email [EMAIL PROTECTED]  (Problems, email [EMAIL PROTECTED])
Lingo-L is for learning and helping with programming Lingo.  Thanks!]

Reply via email to