Working with large numbers in LiveCode

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
andrewferguson
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 184
Joined: Wed Apr 10, 2013 5:09 pm

Working with large numbers in LiveCode

Post by andrewferguson » Wed Jun 04, 2014 12:56 pm

Hello,
I have just started a program that works with large numbers (not for any particular reason, I was just bored). However, when I try and calculate a really large number (for example 2^2^2^2^2^2), I get the result "00000inf". I know this is probably beyond the limits of what LiveCode can process, but is there any way to increase the limit of what LiveCode can calculate?
Thanks,
Andrew

Klaus
Posts: 14210
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Working with large numbers in LiveCode

Post by Klaus » Wed Jun 04, 2014 3:42 pm

Hi Andrew,

you could try to set "the numberformat" to its max, whatever that is.
But I'm sure you will tell us :D


Best

Klaus

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10354
Joined: Wed May 06, 2009 2:28 pm

Re: Working with large numbers in LiveCode

Post by dunbarx » Wed Jun 04, 2014 3:58 pm

Hi.

I can never remember exactly, but you will encounter errors if the result of any arithmetic calculations requires more than about 16 decimal digits of precision.

Craig Newman

andrewferguson
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 184
Joined: Wed Apr 10, 2013 5:09 pm

Re: Working with large numbers in LiveCode

Post by andrewferguson » Wed Jun 04, 2014 7:20 pm

Hi Craig,
The thing is, my program is not working with decimal places, all numbers generated are integers.

In answer to Klaus, I have tried setting the numberFormat to various values, and it changes nothing. I am not sure what to do next. Any advice?

Thanks again,
Andrew

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10354
Joined: Wed May 06, 2009 2:28 pm

Re: Working with large numbers in LiveCode

Post by dunbarx » Thu Jun 05, 2014 1:12 am

The numberformat is a display tool. Wonderful but has no effect on the underlying value.

I meant integers in my post. If you multiply two 15 digit numbers, you will lose all sense of accuracy in about the 16th place.

Craig

Post Reply