-
Notifications
You must be signed in to change notification settings - Fork 171
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
Should we support Float#== ? #481
Comments
@hachi8833 Suggests that we can convert floats into rational. But how to implement this another question I think. |
Maybe using the |
This is an interesting idea, and somewhat audacious, but the consequences need to be extremely well thought out. First, eliminating Ultimately, floating point comparison is a legitimate operation (arguably dangerous, but still legitimate), so it's a matter of analyzing all the use cases. For some cases, forcing precise arithmetic would require a considerable shift in mindset - this can be appropriate, but it requires careful design. What would the users have to do when they need equality comparison? Defaulting the number literals to precise (decimal) representation is interesting, but how would that affect arithmetic? What would The idea it's interesting, but as I wrote, ultimately, you need to think 100000000000% the implications. I think using rational numbers as default is not appropriate, since rational numbers are a related but different concept (see https://github.com/shopspring/decimal for examples). |
I think we should find some real world use cases of floats. Basically I only wrote web applications (or something relates to web applications) so I only have experience on decimal. |
Float comparison is risky and is not a good practice, I think most programmers would agree this. So should we drop the support (or raise specialized error) when user calling this method, or we should just support it?
From my perspective supporting this method and telling user it's better not to use it against the core concept of Goby:
No more best practices
. So I don't want to support it actually, or at least change it to a special API so that user need to be aware what they're doing.How do you think? @saveriomiroddi (actually @hachi8833 and @hanachin and me already have a discussion on Slack, so you can see what we already discussed in
discussion
channel).The text was updated successfully, but these errors were encountered: