jmoenig / Snap

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

Increase digit accuracy (more than 16 digit precision) #621

Open itssumertime opened 10 years ago

itssumertime commented 10 years ago

Some students have math intensive projects that would greatly improve with greater digit precision. Some examples are RSA encryption and graphing calculators created in Snap.

cycomachead commented 10 years ago

Yesss. Admittedly this is a JS problem. See also #390 :)

cycomachead commented 10 years ago

Actually @itssumertime Do you know if this is a display issue or an calculations?

Numbers in JS are double-precision, which should be fine for most projects..I hope.

itssumertime commented 10 years ago

My students were using super large numbers that had more than 16 digits in them and doing modular math with them (for an RSA project), and when I asked what they did, they responded with "I am fairly sure it drops everything after the 16th digit to a 0. We haven't tried since we first started out, so I can't be 100% sure, but I believe what was happening was that the mods were coming back as 0 mod 2".

I think it means that the rough size of the number stayed but actual precise end digits were getting dropped.

itssumertime commented 10 years ago

Actually, he updated me and said that it does return incorrect calculations past a certain point and then "NaN" past another point, but it does seem to retain beyond 16 when checked with Wolfram|Alpha.

So I think you're right @cycomachead

cycomachead commented 10 years ago

Ah, ok. Gotcha. So bignums are something we should have in Snap! :)