>I'm not sure what the "evenly" part means. I guess it means that there is no
>remainder...
That's the idea, but not the source of my problem. The number I'm
looking at is larger than the maxInteger, which makes looking at the
remainder tricky.
Here are a few more details:
I've got a very large integer stored in a float, so I know it ends
with .0. If I divide by 2 and the result ends with .5, then I know it
was an odd number. I could convert to a string and look for ".5", but
thats cheating. :)
Here's some stuff from the msg window:
set f = 1144608783851.0
put f
-- 1144608783851.0000
put f/2
-- 572304391925.5000
Ideally, I'd just stuff the result into an integer and see if its
different than the original. Problem is it's too big.
set i = integer( f/2 )
put i
-- 2147483647
I suppose my question rephrased would be, is it possible to truncate
a float that is larger than the maxInteger?
Cole
>I'm not sure what the "evenly" part means. I guess it means that there is no
>remainder... if that is the case you only need to check if the last digit in
>the number is even or zero. If it is you know the number is divisible by 2.
>
>HTH
>
>Jorge
>
>- -----Original Message-----
>From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On
>Behalf Of Cole Tierney
>Sent: Tuesday, July 17, 2001 8:57 AM
>To: [EMAIL PROTECTED]
>Subject: Re: <lingo-l> Finding If a _huge_ float is divisible by a
>number
>
>
>What a coincedence. A coworker of mine just asked me a similar
>question. In this case we have a huge float (greater than maxinteger)
>and need to know if it is evenly divisable by 2. We can not truncate
>the result, since it won't fit into an integer. We'll probably fall
>back on converting to a string and examining that result.
>
>Any thoughts?
>
>Cole
--
Cole Tierney
Laureate Learning Systems
802.655.4755 x17
http://www.LaureateLearning.com
[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!]