# How do I work with big numbers

Get help using Construct 2

### » Sat Jul 11, 2015 8:34 am

Hi,

i am working on a clicker game, so very big numers are essential. Unfortunately it seems that Construct2 has a number max limit of 9223372036854776000. How do i manage numbers that are much more bigger. In Javascript that isn't a problem at all:

p.e. 9223372036854776000 * 119892 = 1.1058085202425928e+24.
Impossible in Construct2

Somebody has an idea? Thanks in advance
B
4
Posts: 8
Reputation: 212

### » Sat Jul 11, 2015 9:24 am

As speed isn't an issue, you could represent numbers as strings and write code in functions to process them. Ideally you would use arrays but they probably aren't flexible enough.
My tutorial through development blog is at http://myconstruct2dev.blogspot.co.uk/
B
12
S
3
Posts: 221
Reputation: 1,328

### » Sat Jul 11, 2015 5:46 pm

Numbers in C2 are 64bit floating point values so it can handle values like that.
The editor doesn't let you type numbers with scientific notation so maybe that's where the misunderstanding is.
B
98
S
36
G
131
Posts: 5,521
Reputation: 83,505

### » Sat Jul 11, 2015 6:32 pm

If it is 64 bit, then there are 63 bits + sign bit. Given you can't back a 10 digit value into 3 bits this puts an upper bound on the number of digits at 21, and ByteMonkey's number is 24 digits long.
My tutorial through development blog is at http://myconstruct2dev.blogspot.co.uk/
B
12
S
3
Posts: 221
Reputation: 1,328

### » Sat Jul 11, 2015 7:12 pm

Here are the specs:
https://en.wikipedia.org/wiki/Double-pr ... int_format
1 bit for sign, 11 bits for exponent, and 52 bits for the fraction.
With that it's only 15-17 significant decimal digits, but since it also stores an exponent it can store a value up to:
1.7976931348623157 × 10^308
which is plenty for a clicker game.
B
98
S
36
G
131
Posts: 5,521
Reputation: 83,505

### » Sat Jul 11, 2015 10:27 pm

If you use a whole number in an expression, C2 treats it as an integer and truncates it. If your numbers are stored in variables it's not a problem.

Code: Select all
`set text to 999999999999 * 999999999999   => 2003762205206896600num1 = 999999999999num2 = 999999999999set text to num1 * num2=> 9.99999999998e+23`

If you want to use a large number in an expression, use a float:
Code: Select all
`set text to 999999999999.0 * 999999999999.0=> 9.99999999998e+23`
B
55
S
29
G
19
Posts: 1,520
Reputation: 25,850