# Precision on Latitude/Longitude

**URL:** <https://www.ruby-forum.com/t/precision-on-latitude-longitude/85121>\
**Category:** Rails\
**Created:** [February 10, 2007, 6:03am UTC](https://www.ruby-forum.com/t/precision-on-latitude-longitude/85121 "2007-02-10T06:03:44Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![archerid](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/97f17d/32.png) [@archerid](https://www.ruby-forum.com/u/archerid)\
**Post date:** [February 10, 2007, 6:03am UTC](https://www.ruby-forum.com/t/precision-on-latitude-longitude/85121/1 "2007-02-10T06:03:44Z")

</div>

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.
