Compute the latitude precision value for a given code length. Lengths <= 10 have the same precision for latitude and longitude, but lengths > 10 have different precisions due to the grid method having fewer columns than rows.
| 64 | // have the same precision for latitude and longitude, but lengths > 10 have |
| 65 | // different precisions due to the grid method having fewer columns than rows. |
| 66 | double compute_precision_for_length(int code_length) { |
| 67 | if (code_length <= 10) { |
| 68 | return pow_neg(internal::kEncodingBase, floor((code_length / -2) + 2)); |
| 69 | } |
| 70 | return pow_neg(internal::kEncodingBase, -3) / pow(5, code_length - 10); |
| 71 | } |
| 72 | |
| 73 | // Returns the position of a char in the encoding alphabet, or -1 if invalid. |
| 74 | int get_alphabet_position(char c) { |
no test coverage detected