Replies: 1 comment
-
|
It would be awesome to play around with these Unified Real numbers! Here is another article explaining the story behind it: https://chadnauseam.com/coding/random/calculator-app A big reason for using BigNumbers, bigint, and Fractions is to work around the rounding-off issues and limited digits that we have with floating point numbers. So indeed UnifiedReal may make all of them redundant in many real-world cases. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
There is a JavaScript library that implements the numeric system discussed in Towards an API for the real numbers. The virtues of this system include:
Note that the equality problem on computable reals is not decidable in general. However, the UnifiedReals do support
nearlyEqualat any desired level of precision. They also allow you to ask whether it happens to be capable of exactly comparing two real numbers, and recognizes many many cases in which it can.This numeric system was developed for the sake of the Android calculator, so that (for example) it could decide whether the result of a calculation was exactly an integer (in which case it would be displayed without a decimal point) or merely very very close to an integer (in which case it would be displayed with trailing zeros).
Thus, the design of the UnifiedReal class seems extremely consonant with the design goals of mathjs itself, in that mathjs seeks in particular to support its use for practical calculation in a web context.
Hence, I recommend that mathjs seek to support UnifiedReal as one of the types it can use in computation. If it goes well, it should perhaps be the primary/default non-ordinary-JavaScript-number type employed by mathjs. Many of the points we struggle with in mathjs (nearlyEqual, controlling precision for BigNumber, and so on) are rather thoroughly worked out in UnifiedReal.
Beta Was this translation helpful? Give feedback.
All reactions