-
Notifications
You must be signed in to change notification settings - Fork 512
Support numbers larger than 9223372036854775807 #633
Comments
Forum topic: http://scratch.mit.edu/discuss/topic/91072/ |
Oh, as a comment, Scratch apparently switches over to floating point numbers, which I despise. I suggest that BigDecimal is used for all numbers, so the evils of floats don't confuse new Scratchers. |
@TheLogFather, what do you think about this proposal? |
Wouldnt the performance be terrible then? |
Scratch's performance is already pretty bad. 😄 I was thinking that Scratch should switch over to using BigDecimals when numbers get too big for floats to store accurately or whatever ActionScript voodoo it's using right now. |
No reason making it worse, I think. |
Hi @as-com, thanks for submitting this issue. Unfortunately, we don't see an easy fix for this, so we probably won't be able to deal with this. However - you might want to reach out to the people at Snap! (snap.berkeley.edu), who made a variant of Scratch that can tackle more advanced mathematical topics. |
9223372036854775807 is 2^63-1, which is the largest 64-bit integer. When you add 1 to it, strange things happen.
This is evident in my implementation of the Chudnovsky algorithm: http://scratch.mit.edu/projects/48332222/. The project is currently broken for inputs 15 and above, because of this limitation.
A possible solution to this problem is to use a BigDecimal instead of an integer in variables. I found an implementation of BigDecimal in ActionScript 3 here: https://github.com/maurice/BigDecimal.as
The text was updated successfully, but these errors were encountered: