-
Notifications
You must be signed in to change notification settings - Fork 496
Split encoding functions to expose integer encoding for tests #672
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
Comments
#665 should get merged after any changes to the C implementation to validate against macos (which was our canary that something was up). |
So, in general, here are the changes:
|
Just VisualBasic to go! Once that's done, cut a new release (1.0.5) of the project so that the JS CDNs update. |
Since the splitting has turned out to not be necessary, and the only implementation I actually split was C, I'm going to merge them back together. |
As per the comment in #716 (comment), once I add tests that confirm a code's bounding box contains the original coordinates I get failures. It doesn't matter whether I use So I thought I wasn't going to have to do all this but it looks as though I will. |
Quick reality check - in #716, you state that this mostly happens for 15-digit plus codes. I'm not sure these play a large role in real-world applications, since they have sizes of only some square millimeters, likely smaller than precision/accuracy of the devices they are used on. Perhaps it would be a sensible alternative to further restrict valid code lengths instead? |
Hi @bocops good to hear from you! I don't think restricing the code length gets us out completely because at least part of the issue is floating point precision. The tests are using "0.1" in the csv file but when it's read in and converted to a float, IEEE-754 means that you actually get 0.1000000000002 (or something) and the difference is sufficient to cause failures. Also converting the floats to integers using rounding is wrong (issue #717) and I need to address that first. (I'm on vacation for a week so will think about it and update once I get back.) |
Due to issue #717 it's apparent that I still need to do this. For example, with a longitude of
So since we can't even do simple arithmetic (thanks IEEE 754) I'm going to have to do this split (and add tests for the conversion functions). |
The encoding function takes two floats (latitude and longitude), converts to integers and then does the encoding. Due to language, platform and/or os implementations, the initial conversion from float to integer can differ slightly.
To enable consistent tests, we want to make the integer encoding a separate function that can be called by the tests.
It should be called something like
encodeIntegers
, and take as arguments the latitude multiplied by 2.5e7 and longitude multiplied by 8.192e6 (the precision of the longest permissable codes).This needs to be done for each implementation.
The text was updated successfully, but these errors were encountered: