Issue Details (XML | Word | Printable)

Key: ACTIVERECORD_JDBC-25
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Unassigned
Reporter: digger
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
activerecord-jdbc

Problems with precision when converting single float to double

Created: 07/Jul/09 08:08 PM   Updated: 01/Oct/09 08:50 PM   Resolved: 01/Oct/09 08:50 PM
Component/s: None
Affects Version/s: 0.9.1, 0.9.2
Fix Version/s: 0.9.2

Time Tracking:
Not Specified

File Attachments: 1. Text File precision.patch (1 kB) 07/Jul/09 08:08 PM - digger


Tags:


 Description  « Hide

Selecting from a float column (mysql) with the value '5.8' ends up producing 5.80000019073486

The conversion that jruby does internally casts 5.8f -> double. This reveals the imprecision in the float value.

The fix involves using double internally for a value that is float in the database.



Nick Sieger added a comment - 01/Oct/09 08:50 PM

Thanks, applied in 6b55c0a.