On Tuesday, March 16, 2004, at 03:10 PM, Jim Lyons wrote:
I have a long string of 1s and 0s in a variable representing the states of cells in a cellular automata simulation. There can be more than ten thousand cells....
Finally, I wondered if there could be a difference between numeric and string comparison, so I tried changing the comparison above to:
if "z"&nextState = "z"&curState then StopCA
Surprisingly (to me) this fixed the problem.
Yes, = (and 'is') will compare numeric it the data looks numeric (or is internally). I think if it is compared numeric, then it will be compared as double floating point. Your string of 1's and 0's will look like a large numeral with digits. As is, it might compare only the first 15 or so characters.
It would be nice to have a comparison function/operator that is string oriented always and does not try to compare numerically.
Your method will work. Another one is this:
if length(&nextState)=length(&curState) and &nextState contains &curstate
If your states are always the same size, then you can get by with only 'contains'.
Dar Scott
_______________________________________________ use-revolution mailing list [EMAIL PROTECTED] http://lists.runrev.com/mailman/listinfo/use-revolution
