On Thu, Jul 8, 2010 at 12:52 PM, Pedro Teixeira <[email protected]> wrote: > I have a JSON Object with a latitude and longitude String on which I > get the values doing this: > String latitude = picInfo.getString("latitude"); > String longitude = picInfo.getString("longitude"); > > Then I convert them to floats like this: > float latInt = Float.valueOf(latitude).floatValue(); > float longInt = Float.valueOf(longitude).floatValue(); > > And place them on a GeoPoint like this: > GeoPoint X = new GeoPoint((int) (latInt*1E6),(int) (longInt*1E6) ); > > Debugging this values I can see JAVA approximates the values, is there > anyway to keep them exactly the same?
http://en.wikipedia.org/wiki/Floating_point#Representable_numbers.2C_conversion_and_rounding -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy Android App Developer Books: http://commonsware.com/books -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

