-
Notifications
You must be signed in to change notification settings - Fork 563
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
Saving "Infinity" in a Float column #651
Comments
Interesting, what version of the adapter/rails? Also, can you tell me more about the schema (column type) under the hood for |
just a plain FLOAT(8) that came from a migration what was simply created by i googled a bit and it seems that while other DBs support NaN, INF and -INF like the IEEE standard describes. So i guess nothing reasonable could be done on the adapter part. Probably best to see the error like it now happens. |
and my adapter version is the current 5.1.6 |
I do think this is an adapter but tho and we can improve the logic to rase an error when assigning. Here is our Float type. And here is the one we inherit from in ActiveModel. https://github.com/rails/rails/blob/5-1-stable/activemodel/lib/active_model/type/float.rb I think we should handle the |
Might be best for the |
Noticed that when i tried to divide a string number which i converted to_f and then used as a divider, when the float is 0.0 ruby returns
Infinity
instead of a divison by zero erro. Which then the Adapter tries to persist like this:e.g.
Is this correct/intended behavior of the adapter?
This sure was only a bug in my apps code but i wondered why this ended up in the SQL.
The text was updated successfully, but these errors were encountered: