As I have found in my game, https://c.gethopscotch.com/p/yf5px1r0w. There is a computation limit. Click the cookie and buy the bank (I know, so many cookies when you tap, that's for testing reasons). The price goes down instead of up?

# Number Computation Limit?

The link doesn't work.

Ummm, yes it does?

It doesn't for me either ;-;

Not for me. Sry.

...it's on Featured! At least, V0.20 is. :D

@TheRealBlah

"1.4e+06" in your image is what's called scientific notation. It's still a valid number. It just means 1.4 * 10^6 or 1,400,000.

Hopscotch does this because values only retain 6 digits of precision. From the 1st to the last non-zero number can only be 6 places. So a Hopscotch value can not be 1,400,001. That would be 7 digits of precision.

Big numbers can only be XXX,XXX or up to 999,999 (6 digits). After that you can only add 0s to the right. So the next higher value than 1,400,000 is 1,400,010 which is 1.40001e+06. That's why the scientific notation is used. It expresses the 6 digits of precision and then e+06 part tells you where the decimal is (or rather how many 0s to add).

In the case of 1.4e+06, you move the decimal 6 places to the right. The "e" exponent can be -99 to +99 (2 decimals of precision). That's a lot of zeros!

Edit: I should add that calculations are performed with more that 6 digits of precision, but when stored in a value, the calculation is rounded to 6 digits of precision.

Hopscotch can precisely hold values up to around 10 quadrillion, or 1e16 (a little higher, than that, but that's around the number). I had to test this when making GeometryScotch to see how many block states there could be, and that's how I figured that out. Just throwing that out there.

I'm sorry @Valgo. Lest other Hops get confused, I have to say that isn't accurate.

Try this:

Set X = 1,000,000

Increase X by 1 (or Set X = X + 1)

Increase X by -1 (or Set X = X - 1)

Set text to X

It will display 999,999 not 1,000,000 as you'd expect. This is due to the 6 digits of precision and subsequent rounding as I explained above.

The precision used during calculations is different.

Try this:

Set X = 1,000,000 + 1 - 1

Set text to X

It'll display 1e+06 this time as expected. Values only hold up to 6 digits of precision when they're stored. While the formula calculations have much greater precision (until the answer is stored in the value).

Edit: I'd love to be wrong. If you think I am, could you remix this project to show me how to get more than 6 array indexes (eg, 9,999,999).

Note: I could get 7 or 8 indexs by encoding more values into the exponent, but without a log10 function it's not elegant.

I a my not saying that. The original price is that, press the cookie and buy a bank. The number gets smaller but the formula is supposed to make it bigger.

Yes, the 32 bit maximum number.

I don't understand what you're saying is wrong. I tried you're project & every time I click the cookie, the number above it goes **up** by 1.4e6

It's supposed to. Press the "bank" on the side. The price falls instead of increasing.

Now I see what youâ€™re saying. But itâ€™s just doing what youâ€™ve coded.

BankCost is initially set to 1,400,000

When tapped,

NumberOfBanks is increased by 1 (from 0 to 1)

Then BankCost is recalculated as:

round(100x1.15^NumberOfBanks)

round(100x1.15^1)

round(100x1.15)

round(115)

115

So that's what I've been doing wrong!