Re: odd and even numbers
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 this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
RE: odd and even numbers
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 consistent results with all the different options, even with the mod and trunc functions thrown in the mix. 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. -- Ciao, Paul D. DeRocco Paulmailto:pdero...@ix.netcom.com ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: odd and even numbers
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 number subtract 1 from it convert it to a string put it back on the wall end repeat -- -Mark Wieder mwie...@ahsoftware.net ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
RE: odd and even numbers
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 take one down convert it to a number subtract 1 from it convert it to a string put it back on the wall end repeat Exactly! -- Ciao, Paul D. DeRocco Paulmailto:pdero...@ix.netcom.com ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: odd and even numbers
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 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 number subtract 1 from it convert it to a string put it back on the wall end repeat Exactly! -- Ciao, Paul D. DeRocco Paulmailto:pdero...@ix.netcom.com ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode -- On the first day, God created the heavens and the Earth On the second day, God created the oceans. On the third day, God put the animals on hold for a few hours, and did a little diving. And God said, This is good. ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: odd and even numbers
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 Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: odd and even numbers
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 ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode -- On the first day, God created the heavens and the Earth On the second day, God created the oceans. On the third day, God put the animals on hold for a few hours, and did a little diving. And God said, This is good. ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: odd and even numbers
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: odd and even numbers How do you test a number to see if it is a whole odd or even number? ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: odd and even numbers
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 humphrey b...@bluewatermaritime.com wrote: How do you test a number to see if it is a whole odd or even number? ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode -- On the first day, God created the heavens and the Earth On the second day, God created the oceans. On the third day, God put the animals on hold for a few hours, and did a little diving. And God said, This is good. ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
RE: odd and even numbers
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 numbers on a two's complement machine (which is probably every machine that LiveCode ever has or ever will run on. In C, one can test for an odd integer with x 1. Yet bitAnd doesn't work on negative numbers. It is documented that way, but I think this is an unnecessary and unexpected limitation. -- Ciao, Paul D. DeRocco Paulmailto:pdero...@ix.netcom.com ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: odd and even numbers
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? if last char of x is among the items of 0,2,4,6,8 then answer even else answer odd But personally I always use mod even though I don't go to parties. -- Jacqueline Landman Gay | jac...@hyperactivesw.com HyperActive Software | http://www.hyperactivesw.com ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: odd and even numbers
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. ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: odd and even numbers
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, Richmond richmondmathew...@gmail.comwrote: 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. __**_ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/**mailman/listinfo/use-livecodehttp://lists.runrev.com/mailman/listinfo/use-livecode __**_ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/**mailman/listinfo/use-livecodehttp://lists.runrev.com/mailman/listinfo/use-livecode -- On the first day, God created the heavens and the Earth On the second day, God created the oceans. On the third day, God put the animals on hold for a few hours, and did a little diving. And God said, This is good. ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: odd and even numbers
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: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: odd and even numbers
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 visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode -- On the first day, God created the heavens and the Earth On the second day, God created the oceans. On the third day, God put the animals on hold for a few hours, and did a little diving. And God said, This is good. ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: odd and even numbers
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 execution?) Kee Nethery On Aug 5, 2013, at 1:30 PM, Paul D. DeRocco pdero...@ix.netcom.com wrote: 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 numbers on a two's complement machine (which is probably every machine that LiveCode ever has or ever will run on. In C, one can test for an odd integer with x 1. Yet bitAnd doesn't work on negative numbers. It is documented that way, but I think this is an unnecessary and unexpected limitation. -- Ciao, Paul D. DeRocco Paulmailto:pdero...@ix.netcom.com ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: odd and even numbers
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 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 execution?) Kee Nethery On Aug 5, 2013, at 1:30 PM, Paul D. DeRocco pdero...@ix.netcom.com wrote: 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 numbers on a two's complement machine (which is probably every machine that LiveCode ever has or ever will run on. In C, one can test for an odd integer with x 1. Yet bitAnd doesn't work on negative numbers. It is documented that way, but I think this is an unnecessary and unexpected limitation. -- Ciao, Paul D. DeRocco Paulmailto:pdero...@ix.netcom.com ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: odd and even numbers
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 they failed to produce neither (i.e. they tested for evenness, so if not even then you'd have to assume it was odd). Perhaps the question should be re-stated as How do you test a whole number to see if it is even or odd? in which case the earlier solutions would be good. -- Alex. On 05/08/2013 21:17, william humphrey wrote: How do you test a number to see if it is a whole odd or even number? ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
RE: odd and even numbers
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 have been incomplete, because they failed to produce neither (i.e. they tested for evenness, so if not even then you'd have to assume it was odd). 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. It's interesting how people approach things differently when they're using an interpreted scripting language. For instance, in C, one would never divide by two and then see if the remainder is nonzero, because a divide is a comparatively slow operation; one would use a bitwise AND, since that is typically a single-clock op. But in LC, that difference is swamped by the time spent processing the script. And in C, one would NEVER base the analysis on the printed representation, because that would involve generating the printed representation. I don't know how LC represents things, but I would think that it would represent values by the combination of a numeric representation and a string representation, either one of which (but not both) may be missing, deferring generation until it is needed. If that's the case, just asking for the last character of a number might very well cause the representation to be generated, which would be significantly costlier than doing arithmetic on it. -- Ciao, Paul D. DeRocco Paulmailto:pdero...@ix.netcom.com ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: odd and even numbers
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 point. The original question said: How do you test a number to see if it is a whole odd or even number? i.e. test a number (no explicit assumptions about that number included) to see whether or not it is a whole odd or even number. My question (and attempted re-stating of the original) was intended to make it clear whether wholeness is a valid assumption or is part of the investigation. btw - not trying to pick on Jacque, but even if you assume the value is an integer, then her solution will fail in some cases. Why? Because if you test 2. LC will tell you it is an integer - but although it should be even, it does not finish with any of 02468 ?! function aa p return p (p is an integer) end aa on mouseUp put aa(2.) exit mouseUp Of course, if it is part of the investigation then we can then talk about the exact definition of whole number - it's not as widely agreed or unambiguous as I thought it was. Your points about the interesting differences between this question in LC vs the same question in C are absolutely right and interesting.. -- Alex. ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: odd and even numbers
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 possible. Here's the fastest I could come up with... constant kEven=02468 put 3.14169 into tValue -- do this outside the loop put trunc(tValue) into y put the milliseconds into x repeat 1 times -- this line is slow -- put the last char of trunc(y) is in kEven into tIsEven -- much faster put the last char of y is in kEven into tIsEven end repeat put the milliseconds -x -- -Mark Wieder mwie...@ahsoftware.net ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: odd and even numbers
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 you would even notice? You aren't using a tool like LC because you are worried about squeezing cycles. On Mon, Aug 5, 2013 at 9:05 PM, Mark Wieder mwie...@ahsoftware.net wrote: 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 possible. Here's the fastest I could come up with... constant kEven=02468 put 3.14169 into tValue -- do this outside the loop put trunc(tValue) into y put the milliseconds into x repeat 1 times -- this line is slow -- put the last char of trunc(y) is in kEven into tIsEven -- much faster put the last char of y is in kEven into tIsEven end repeat put the milliseconds -x -- -Mark Wieder mwie...@ahsoftware.net ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode -- On the first day, God created the heavens and the Earth On the second day, God created the oceans. On the third day, God put the animals on hold for a few hours, and did a little diving. And God said, This is good. ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
RE: odd and even numbers
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 BCD? Does anyone know how the engine works? -- Ciao, Paul D. DeRocco Paulmailto:pdero...@ix.netcom.com ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: odd and even numbers
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 performs arithmetic in this QCC entry - http://quality.runrev.com/show_bug.cgi?id=9349 Regards Peter ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
RE: odd and even numbers
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 of going to decimal in the future. I posted this response: Where decimal arithmetic still fails is when a quotient doesn't have a finite representation. 1/3*3 will always be .9... to whatever precision the decimal arithmetic is done. An alternative is to define an 'epsilon' global property, with a default value of something like 1e-15, which says how close numbers must be in order to be considered equal. Comparing a and b could be done by actually comparing (a-b) to (a+b)*epsilon. Allow the user to set epsilon to anything from zero to, say, 0.1. This works for any two positive numbers; negative numbers would work the same, but have their sense reversed. Numbers could be compared to zero, or to numbers of the opposite sign, by comparing their difference to epsilon. What that page doesn't make explicit is whether even intermediate values in calculations are converted to and from strings. Since many numeric values are never needed in their human-readable form (loop counters being the most obvious example), having a way to deal with binary numbers and decimal numbers interchangeably would be a HUGE win. My suggestion was to represent values as the combination of a number and a string, one of which may be missing and only generated whenever something asks for it. A missing number could be represented as a NaN, and a missing string by a null pointer. -- Ciao, Paul D. DeRocco Paulmailto:pdero...@ix.netcom.com ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: odd and even numbers
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 slower due to the overhead of the function calls. If the compiled code were optimized, a divide-by-two operation would end up being a bitwise right shift, which would be as fast as the chunk. 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 you would even notice? You aren't using a tool like LC because you are worried about squeezing cycles. No, but I sometimes need to optimize to squeeze cycles *because* I'm using a high-level tool like LC. -- -Mark Wieder mwie...@ahsoftware.net ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: odd and even numbers
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: 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 slower due to the overhead of the function calls. If the compiled code were optimized, a divide-by-two operation would end up being a bitwise right shift, which would be as fast as the chunk. 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 you would even notice? You aren't using a tool like LC because you are worried about squeezing cycles. No, but I sometimes need to optimize to squeeze cycles *because* I'm using a high-level tool like LC. -- -Mark Wieder mwie...@ahsoftware.net ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: odd and even numbers
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 different options, even with the mod and trunc functions thrown in the mix. -- -Mark Wieder mwie...@ahsoftware.net ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode