Forum: Ruby on Rails Precision on Latitude/Longitude

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
980f5824b1cd96f1882b7caf5bbaebdf?d=identicon&s=25 archerid (Guest)
on 2007-02-10 06:03
Hi All,

I'm having a problem with Rails truncating latitude and longitude
values. In my database (mySQL) table, my lat/lng columns are defined as
Decimal(25,20), but I get different precision values depending on what I
do. If I post, via XML, a value of 37.436490000000006 to my controller,
what gets inserted into the db table is 37.43648999999999900000. Then,
when I fetch the record in a controller and render it out to an XML
file, I get 37.43649.

Is there another datatype I should be using in my database table, or is
there something I can do on the Rails side to force the precision.

Thanks in advance for any help you can offer.
This topic is locked and can not be replied to.