Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Latitude/longitude parsing loses precision by converting to float #37

Closed
micolous opened this issue Jun 18, 2014 · 1 comment
Closed

Comments

@micolous
Copy link

It appears in https://github.com/tkrajina/gpxpy/blob/master/gpxpy/utils.py#L58, the to_numeric function uses the built-in float to convert a str to a numeric value.

As a result, the latitude and longitude loses precision, and the amount of precision lost is dependent on the Python implementation.

Instead, this should use decimal.Decimal, which has a fixed precision.

@tkrajina
Copy link
Owner

I'm aware of this. For my own usage this loss of precision is not a big deal but agree that for some use-cases this may be important.

Anyway, instead of changing the to_numeric function, I thinks it is better to change the parser in the gpx-1.1 since I rewrote the parser there and I plan to merge it to master. I think I'll use float() by default and decimal.Decimal only when the user needs it.

@tkrajina tkrajina closed this as completed Mar 3, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants