Skip to content
This repository has been archived by the owner on Sep 3, 2019. It is now read-only.

Support numbers larger than 9223372036854775807 #633

Closed
as-com opened this issue Feb 17, 2015 · 7 comments
Closed

Support numbers larger than 9223372036854775807 #633

as-com opened this issue Feb 17, 2015 · 7 comments
Assignees
Milestone

Comments

@as-com
Copy link

as-com commented Feb 17, 2015

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

@as-com
Copy link
Author

as-com commented Feb 17, 2015

Forum topic: http://scratch.mit.edu/discuss/topic/91072/

@as-com
Copy link
Author

as-com commented Feb 17, 2015

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.

@2jour 2jour added the Triage label Feb 17, 2015
@2jour 2jour self-assigned this Feb 17, 2015
@as-com
Copy link
Author

as-com commented Feb 17, 2015

@TheLogFather, what do you think about this proposal?

@AndersBillLinden
Copy link
Contributor

Wouldnt the performance be terrible then?

@as-com
Copy link
Author

as-com commented Feb 18, 2015

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.

@AndersBillLinden
Copy link
Contributor

No reason making it worse, I think.

@2jour 2jour added this to the Review milestone Feb 19, 2015
@2jour 2jour assigned kaschm and unassigned 2jour Feb 19, 2015
@kaschm
Copy link

kaschm commented Feb 24, 2015

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.

@kaschm kaschm closed this as completed Feb 24, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants