-
Notifications
You must be signed in to change notification settings - Fork 70
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Not precise enough #12
Comments
The fractions are still represented internally with floats for numerator and denominator. |
This script works fine: http://czurnieden.github.io/bernoulli.html |
Thanks for reporting this issue. We discuss this issue for quite some time now. Fraction.js isn't meant to be an arbitrary precision library (yet). It's a performance tradeoff between having a fast library and a library like decimal.js or the library Jens mentioned, which extends to rational numbers. @josdejong We should definitely think about an arbitrary precision version, for complex.js, fraction.js and quaternion.js. The question is, what is the best way to tackle this issue. Either duplicate the original source file and add an abstract version. Another way would be to create completely new projects (which I don't like, I would keep it in one project where the user can decide). As for math.js, there is already decimal.js embedded. As such the definition of the abstract type would be quite easy (plus including a different source file). What do you think? |
@josdejong Have you seen https://developers.google.com/web/updates/2018/05/bigint ? :) This looks pretty promising and I will extend the library as soon as it is in node.js. |
Yes, this is really great! See also josdejong/mathjs#1096 |
It would be nice and powerful if Fraction.js could handle "any" numeric type: number, bigint, BigNumber. We've discussed something like that in the paste in josdejong/mathjs#694 |
Hmm, for complex.js this might make sense. Fraction.js can handle any input type, but I think internally the new way to go should be BigInt. For the implementation, I will create a simple polyfill for BigInt, which operates on number like before. Maybe I'll add a constant which indicates if full BigInt support is available. |
Please see #28 |
It's not precise enough:
I use it for money calculation, so this behaviour is not acceptable.
The text was updated successfully, but these errors were encountered: