numbas / Numbas

A completely browser-based e-assessment/e-learning system, with an emphasis on mathematics
http://www.numbas.org.uk
Apache License 2.0
199 stars 118 forks source link

Use BigInt for the integer and rational data types #908

Open christianp opened 2 years ago

christianp commented 2 years ago

At the moment integers and fractions are represented using the number type, which rounds to infinity when you get above 2^53. BigInt allows arbitrarily large values.

caniuse says that today 89% of devices support BigInt. The main blocker seems to be iOS before 14.0.

This relates to #527.

christianp commented 1 year ago

Now 94.59% of devices. Our threshold is 95%, so I'm going to say that's close enough.

christianp commented 1 year ago

How has the number gone down? caniuse says 93.76%!

christianp commented 1 year ago

If we just set the value property to be a BigInt, lots of custom JS code will break, because BigInt can't automatically be converted to Number.

So if we did this, we'd have to have parallel value and bigValue properties, which would be confusing.