Skip to content

Saving "Infinity" in a Float column #651

Open
@neongrau

Description

@neongrau

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.

value = "0"
record.some_float = 1000 / value.to_f
ActiveRecord::StatementInvalid: TinyTds::Error: Error converting data type nvarchar to float.
...
@0 = Infinity

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions