What is the size limit for numbers in LC? -- and multiplying really large numbers

Geoff Canyon gcanyon at gmail.com
Sun Sep 8 03:02:37 EDT 2013


On Sat, Sep 7, 2013 at 2:07 PM, David Bovill <david.bovill at gmail.com> wrote:

> The bits I don't quite get yet are:
>
>    1. ignore any overflows (just use the lowest 64 bits)
>    2. grab an 8-byte chunk as a 64-bit integer
>    3. add it to the checksum
>
> My understanding is that I should be:
>
>    1. Using binaryDecode to "grab an 8-byte chunk as a 64-bit integer"
>    2. Livecode's format function to "ignore any overflows (just use the
>    lowest 64 bits)"
>
> However, as I understand it LiveCode does not do 64bit integers, which is
> why the "Q" or "q" options for binaryDecode are not available? So I am not
> quite sure what I should be grabbing.
>


I answered in the original thread with code that I think solves this, but
not in this way. In the above description:

1. "ignore any overflows" just means that every time you do an operation
and end up with more than 64 bits, you can drop anything higher. In my
solution I ignored this until the end and truncated the final answer.
2. Yes, but remember the little-endian-ness of the byte order (I only found
this through trial and error)
3. yep

then:

1. This would work. It appears you'd need to use "B*" on each byte
2. I suppose, but in this context it seems easier just to take what you
want by character count of the results.

I don't think LC has bit-math at all, hence why I stayed with decimal until
the very end. It would be possible to write functions, but they would be
slower than (for example) my bigPlus function, since it can parse the
arguments into 14-digit chunks, while any solution for bases would need to
go character-by-character to get the digits/carries right.

gc



More information about the use-livecode mailing list