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

Split encoding into floating and integer functions #677

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
Open

Conversation

drinckes
Copy link
Contributor

Issue #672

This splits the C encoding function into a public function that takes doubles, and one that takes integers.

It explicitly rounds multiplying the degrees by the precision. This will cause a small number of encoding tests to require correcting the codes.

The issue was that the C code:

long long int lat = degrees * precision;
lat += 90 * precision;

and

long long int lat = 90 * precision;
lat += degrees * precision

didn't always produce the same result. In the first, it truncates the value of degrees * precision, in the second it appears to (mostly) round it before adding it.

@drinckes drinckes added the c label Jan 10, 2025
@drinckes drinckes linked an issue Jan 10, 2025 that may be closed by this pull request
@drinckes
Copy link
Contributor Author

I've verified the conversions of the coordinates in the CSV file to the changed generated codes, and the new codes look correct. I'm going to update them - this will break all other implementations until I get around to them one by one.

@drinckes
Copy link
Contributor Author

@bocops @fulldecent @rsramek would appreciate if you could take a look at the change please, my C isn't that hot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Split encoding functions to expose integer encoding for tests
1 participant