Raises a number to an exponent, handling negative exponents.
| 52 | |
| 53 | // Raises a number to an exponent, handling negative exponents. |
| 54 | double pow_neg(double base, double exponent) { |
| 55 | if (exponent == 0) { |
| 56 | return 1; |
| 57 | } else if (exponent > 0) { |
| 58 | return pow(base, exponent); |
| 59 | } |
| 60 | return 1 / pow(base, -exponent); |
| 61 | } |
| 62 | |
| 63 | // Compute the latitude precision value for a given code length. Lengths <= 10 |
| 64 | // have the same precision for latitude and longitude, but lengths > 10 have |
no outgoing calls
no test coverage detected