Skip to content
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

replace parseFloat with native implementations #786

Open
jvasileff opened this issue Oct 20, 2015 · 2 comments
Open

replace parseFloat with native implementations #786

jvasileff opened this issue Oct 20, 2015 · 2 comments

Comments

@jvasileff
Copy link
Member

parseFloat() currently has some problems with precision and errors:

Given how much effort would be required to write a really good parseFloat(), especially one that is cross-platform, I suggest (at least for now) we replace the current implementation with native implementations that delegate to platform apis.

@gavinking
Copy link
Member

Well I think I've resolved the issues with precision. Now, surely my implementation in Ceylon is significantly slower than the native implementations would be, but we have not actually tested anything to see how much difference there really is.

@jvasileff
Copy link
Member Author

It looks like the new impl solves the critical problems, and the only use case for improved precision I can think of would be minimizing accumulated error for float->string->float roundtrips. But the lack of precision does remain, and I'd hazard to guess that on JS, the difference in performance may be 10x, 100x, or more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants