jmoenig / Snap

a visual programming language inspired by Scratch
http://snap.berkeley.edu
GNU Affero General Public License v3.0
1.49k stars 743 forks source link

Bignum library broken #2159

Open ToonTalk opened 6 years ago

ToonTalk commented 6 years ago

A few months ago it was working fine but today at least factorial is broken. 1000! is infinity (and it clicking on it doesn't display anything).

image

jmoenig commented 6 years ago

Quick test: The library does work fine and the same as always for me, showing the precise big value when clicking on the reporter. the stage watcher is unaffected by the library and therefore shows the simplified JS value.

ToonTalk commented 6 years ago

Strange. I just tried again. Just ran "USE BIGNUMS true" and then 1000! and nothing happens. And nothing in the console. In Version 67.0.3396.99

Then I tried it again in FireFox 61.0.1 and it worked fine.

ToonTalk commented 6 years ago

And same problem with Chrome 68.0.3440.75

ToonTalk commented 6 years ago

Works fine in Edge as well. (All tests are Windows 10)

By the way, why doesn't USE BIGNUMS have 'true' as the default value?

ToonTalk commented 6 years ago

Probably a coincidence but Chrome just added direct support for bignums - https://developers.google.com/web/updates/2018/05/bigint

brianharvey commented 6 years ago

Maybe not a coincidence. Chrome's bignum support doesn't provide the rest of the Scheme numeric tower, though, so it's not so useful.

I confirm that it's broken. 795! has this interesting behavior:

google chrome001

Numbers visible, but not in a speech bubble. And 800! doesn't display anything, although it is correctly computing the value:

google chrome002 google chrome003

So the problem is in the display of very long strings, not in the computation.

ToonTalk commented 6 years ago

I wonder if anyone will update the rest of the Scheme numeric tower to sit on top of the browser's bignum support (once it becomes ubiquitous -- it is a proposed standard) since it is 2 or 3 times faster in benchmarks with 4 libraries implementing bignums.

brianharvey commented 6 years ago

They should just put all of it in the standard.