-
Notifications
You must be signed in to change notification settings - Fork 167
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
Can we use Rational Numbers instead of the Epsilon Hack? #46
Comments
@davidbyrd11 I'm not sure about that library, and I don't think it's necessarily efficient (to the point at which it overcomes the error of floating points). However, I do agree we need a better solution the epsilon hack. Worth researching this weekend. |
@sjkaliski In Javascript precision is lost for values passed +/- 9007199254740992. Everything after that becomes estimates. Example: The only way to get passed this problem is to implement basic operations to support just numbers, but doing that would slow. I think it would be cool if you could include Ratio.js inside your library but I'm not sure how well it fit. |
@sjkaliski @LarryBattle is this going anywhere? I don't necessarily think the epsilon hack is awful given the circumstances. |
I looked through number.js code and couldn't find any good use cases for replacing the epsilon hack with ratio.js. The epsilon hack is basically this.
Could someone provide me an example where lost of precision is currently a issue? |
I don't think it's an issue, really. I'll just close this unless someone else has an issue with it. |
It depends on what you want to concentrate on for the library in general, but there will be many things you cant do without a BigNumber, or some sort of fraction/rational number engine. i.e. I wrote a simple addition to the generator.js to generate a pascal triangle row just to play with the library, and can only get to row 55 accurately using the simple JS number precision. If there was a "factorized" number class for working with Integers, you could get much farther for certain things like this. My primary interest is for playing with integer calculations and statistics. The library algorithms in general seem very efficient :) generate.pascal = function (n, result) { |
https://github.com/LarryBattle/Ratio.js
@sjkaliski @ethanresnick
The text was updated successfully, but these errors were encountered: