I only said it was weird because the result was odd. Thanks everyone
for your help, as always, and it's not my fault this thread
degenerated into a golf clap/ whatever that is.
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit
From: Mark Wieder
Hmmm... for now, just ignore my benchmarks. I'm getting quite
different results with LC 4.6.4 and LC 6.1rc1, and I think there's
some garbage collection going on in the background. Plus I found half
a dozen LC update processes running.
I'm currently seeing fairly
Paul-
Monday, August 5, 2013, 10:59:27 PM, you wrote:
I hope the engine is smart enough that repeat 1 times doesn't convert
the count back and forth between a string and a number ten thousand times.
repeat with the number of bottles of beer on the wall
take one down
convert it to a
From: Mark Wieder
Paul-
Monday, August 5, 2013, 10:59:27 PM, you wrote:
I hope the engine is smart enough that repeat 1 times
doesn't convert
the count back and forth between a string and a number ten
thousand times.
repeat with the number of bottles of beer on the wall
I think you forgot to pass it around.
On Tue, Aug 6, 2013 at 2:25 AM, Paul D. DeRocco pdero...@ix.netcom.comwrote:
From: Mark Wieder
Paul-
Monday, August 5, 2013, 10:59:27 PM, you wrote:
I hope the engine is smart enough that repeat 1 times
doesn't convert
the count back
On Tue, Aug 6, 2013 at 8:01 AM, Mike Kerner mikeker...@roadrunner.com wrote:
I think you forgot to pass it around.
Maybe it was a good brand?
--
Dr. Richard E. Hawkins, Esq.
(702) 508-8462
___
use-livecode mailing list
use-livecode@lists.runrev.com
golf clap/ #winner
On Tue, Aug 6, 2013 at 2:10 PM, Dr. Hawkins doch...@gmail.com wrote:
On Tue, Aug 6, 2013 at 8:01 AM, Mike Kerner mikeker...@roadrunner.com
wrote:
I think you forgot to pass it around.
Maybe it was a good brand?
--
Dr. Richard E. Hawkins, Esq.
(702) 508-8462
Hi.
Just ask yourself this
answer testNumber mod 2
If you get a 1, testnumber is odd, if a 0, even.
Craig Newman
-Original Message-
From: william humphrey b...@bluewatermaritime.com
To: How to use LiveCode use-livecode@lists.runrev.com
Sent: Mon, Aug 5, 2013 4:17 pm
Subject:
Craig is such a party pooper. There have got to be ways that are more fun
and demonstrate the breadth of the language to new users
if x/2 contains . then answer odd else answer even
if x/2 = x div 2 then answer even else answer odd
hm what else?
On Mon, Aug 5, 2013 at 4:17 PM, william
From: dunb...@aol.com
Just ask yourself this
answer testNumber mod 2
If you get a 1, testnumber is odd, if a 0, even.
Careful, x mod 2 will be -1 for a negative odd number. Better to test for
zero (even) or nonzero (odd).
By the way bitwise AND normally works for negative or positive
On 8/5/13 3:25 PM, Mike Kerner wrote:
Craig is such a party pooper. There have got to be ways that are more fun
and demonstrate the breadth of the language to new users
if x/2 contains . then answer odd else answer even
if x/2 = x div 2 then answer even else answer odd
hm what else?
On 08/05/2013 11:17 PM, william humphrey wrote:
How do you test a number to see if it is a whole odd or even number?
Probably try and divide it by 2 and see if there is a remainder.
That's what Miss Neville taught me when I was 6.
Richmond.
___
OOH, I like Jacque's answer - THERE's one that just smacks other languages
in the jaw - the only thing I might do is get rid of the commas - can't you
do if the last char of x is in 02468?
I like Paul's, too. That demonstrates a bit of power in the language.
On Mon, Aug 5, 2013 at 4:44 PM,
if x/2 = x div 2 then answer even else answer odd
This one is weird.
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription
preferences:
that's ok, it works.
On Mon, Aug 5, 2013 at 5:31 PM, william humphrey b...@bluewatermaritime.com
wrote:
if x/2 = x div 2 then answer even else answer odd
This one is weird.
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please
OK I'll toss in a combo.
put ((last char of trunc(x)) mod 2) = 0 into isOdd
allows for a floating value of x which it should never be given but would be
nice if it could handle
allows for a quick mod calculation of a single digit rather than whatever the
entire value of x is (perhaps speeds up
set the itemdelimiter to .
put (the number of items in (x/2) is 2) into isOdd
On Mon, Aug 5, 2013 at 3:37 PM, kee nethery k...@kagi.com wrote:
OK I'll toss in a combo.
put ((last char of trunc(x)) mod 2) = 0 into isOdd
allows for a floating value of x which it should never be given but
Can you please define the problem more precisely ?
It seems to me there are 3 possible answers to come out from any
solution (or maybe more)
1 -- odd
2 -- even
2.5 -- neither odd nor even (or, if you prefer, not whole)
AFAICS, all the proposed solutions so far have been incomplete, because
From: Alex Tweedly
Can you please define the problem more precisely ?
It seems to me there are 3 possible answers to come out from any
solution (or maybe more)
1 -- odd
2 -- even
2.5 -- neither odd nor even (or, if you prefer, not whole)
AFAICS, all the proposed solutions so far
On 05/08/2013 23:53, Paul D. DeRocco wrote:
.
I thought the original question stated the assumption that the number was
whole. Normally, one tests to see if a number is an integer by comparing it
to its integer part. In LC you just ask if it is an integer.
No, it didn't. That was precisely my
Alex-
The problem with things like mod and / is that they're expensive in
terms of scaling: they're about 3.5 times slower than last char. If
you're just doing this once, it shouldn't matter much. But if you need
to determine oddness in a loop you want to do as much processing
outside the loop as
It's fascinating that the chunk operator is faster than the integer modulo
or even the FP division.
The debate over computational efficiency and what you should and shouldn't
do are interesting when you have BIG loops, but did anybody bother to
figure out how many iterations it would take before
From: Mark Wieder
The problem with things like mod and / is that they're expensive in
terms of scaling: they're about 3.5 times slower than last char.
Is that because values are always converted to binary and back to a string
when doing arithmetic, or because the arithmetic itself is done in
Paul
On 6 Aug 2013, at 10:57, Paul D. DeRocco wrote:
Is that because values are always converted to binary and back to a string
when doing arithmetic, or because the arithmetic itself is done in BCD? Does
anyone know how the engine works?
Mark Waddingham kindly explains how the engine
From: Peter W A Wood
Mark Waddingham kindly explains how the engine performs
arithmetic in this QCC entry -
http://quality.runrev.com/show_bug.cgi?id=9349
That page states that arithmetic is done on 64-bit floating-point values,
which is what I always assumed, and suggests the possibility
Mike-
Monday, August 5, 2013, 6:38:09 PM, you wrote:
It's fascinating that the chunk operator is faster than the integer modulo
or even the FP division.
The last char chunk can be determined quickly with a pointer.
Math operators are turned over to the math library, which will
necessarily be
I assume using baseconvert has the same slowdown issue? A function call
from library, so not as fast?
put the last char of baseconvert(x,10,2) is 1 into isOdd
On Mon, Aug 5, 2013 at 10:56 PM, Mark Wieder mwie...@ahsoftware.net wrote:
Mike-
Monday, August 5, 2013, 6:38:09 PM, you wrote:
Hmmm... for now, just ignore my benchmarks. I'm getting quite
different results with LC 4.6.4 and LC 6.1rc1, and I think there's
some garbage collection going on in the background. Plus I found half
a dozen LC update processes running.
I'm currently seeing fairly consistent results with all the
28 matches
Mail list logo