Take the 2-minute tour ×

I'm working with latitude / longitude in my android app. Why do people convert them to 1E6? (i.e. * 1000000) It seems like an unnecessary step. What's the benefit? Can't the values simply be stored as a double or float? Please explain. Thanks -

share|improve this question
Integer math is quicker than floating point. –  Geobits Jul 3 '12 at 19:07
add comment

3 Answers

up vote 1 down vote accepted

I worked with GPS devices sometime ago and I used to do that kind of conversion mainly for the following reasons:

  1. Having a value that is greater then 1E6 does not really make sense, unless you have the latest and greatest military GPS devices that have great precision
  2. 1E6 can hold in an int which is 4 bytes so that saves you half of the space if you were using a double
share|improve this answer
Thanks for the feedback. I'm gone back and updated my source code to store the values as (1E6) integers instead of Strings. –  nesterenes Jul 6 '12 at 20:18
add comment

Why do people convert them to 1E6?

Because the Google Maps add-on API requires it.


You are probably too young to remember when desktop PCs -- let alone notebooks -- might not have a floating-point co-processor. You would choose to buy a 486SX or 486DX CPU, with the SX variant being cheaper but lacking the floating-point co-processor. CPUs without a floating-point co-processor can still do floating-point calculations, but very slowly. Intel dumped the whole SX/DX split when they created the Pentium processor, and so for most conventional PCs, this has not been an issue for some time.

However, the ARMv5 CPUs at the heart of the first couple of generations of Android devices also lacked a floating-point co-processor. Trying to do Java floating-point math on such devices was slow, too slow for Google Maps. So, they switched units from degrees to microdegrees so that they could do all their calculations in fixed-point math, which was acceptably fast.

share|improve this answer
+1. I was not aware of this limitation on Android! –  GETah Jul 3 '12 at 19:15
add comment

The precision beyond 1E6 is not accurate enough according to Google's API choice. It saves space for large assortments of map points like those required for a complex mapping system like Google's.

share|improve this answer
add comment

Your Answer


