Skip to content

Conversation

IDisposable
Copy link

typo
latitudePrecission -> latitudePrecision

return value doesn't need to be VARCHAR(MAX), since max digits is 15 and doesn't include the +, we should be using 16
VARCHAR(MAX) -> VARCHAR(16)

clarity for order of operations
POWER(@EncodingBase, @codeLength / -2 + 2) - > POWER(@EncodingBase, (@codeLength / -2) + 2)

Not changed:
Should we range-check @codeLength for a maximum value? It could mess up the precision calculations in the latitude = 90 logic around line 46.

typo
  `latitudePrecission` -> `latitudePrecision`

return value doesn't need to be `VARCHAR(MAX)`, since max digits is 15 and doesn't include the `+`, we should be using `16`
  `VARCHAR(MAX)` -> `VARCHAR(16)`

clarity for order of operations
  `POWER(@EncodingBase, @codelength / -2 + 2)` - > `POWER(@EncodingBase, (@codelength / -2) + 2)`

Not changed:
  Should we range-check `@codeLength` for a _maximum_ value? It could mess up the precision calculations in the latitude = 90 logic around line 46.
-- Latitude 90 needs to be adjusted to be just less, so the returned code can also be decoded.
IF (@latitude = @LatitudeMax)
BEGIN
DECLARE @latitudePrecission DECIMAL(9,6);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the improvements! And for pointing out the typo. Please change it also here on line 46 so I can merge your pull request. Thanks!

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

Successfully merging this pull request may close these issues.

2 participants