-
Notifications
You must be signed in to change notification settings - Fork 110
Floats converted into ints during reading #104
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
Comments
I suppose it is not converted to integer. Is `ls-read-from-string' working in the host? The issue is that in Javascript every number is a float. So we do not difference between 1.0 and 1. An integer is just a float point with no fractional part. Any idea about how to solve this? We have to implement bignums yet. Perhaps this library https://github.com/jtobey/javascript-bignum would solve both problems? |
Ah, okay. I wasn't aware of that detail of javascript. That library does look like a good solution. I'll try to integrate it on my fork and see how it goes. At the very least it will help us out with rationals and bignums, even if it doesn't deal with this problem. Do you think there would be performance implications in using this for all numbers? Should we keep using the primitive type for fixnums (maybe with some kind of boxing to distinguish them from floats?) and transparently convert when they would overflow to avoid the overhead when it is unnecessary? |
Nevermind that last question, I see that the library does that itself anyway. Even better! |
Sure. However the problem still remains. How to force the disjointness of rational and float (and so integer and float)? |
I haven't delved too deep into the library yet, but it looks like it has functions like |
Floats ending in
.0
get read in as ints:The text was updated successfully, but these errors were encountered: