MCPcopy Create free account
hub / github.com/comaps/comaps / pow_neg

Function pow_neg

3party/open-location-code/openlocationcode.cc:54–61  ·  view source on GitHub ↗

Raises a number to an exponent, handling negative exponents.

Source from the content-addressed store, hash-verified

52
53// Raises a number to an exponent, handling negative exponents.
54double 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

Callers 2

RecoverNearestFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected