From 604d2c698b7f91d468c3197f577cbd71c89c9408 Mon Sep 17 00:00:00 2001 From: Dennis Luxen Date: Tue, 17 Jun 2014 12:50:29 +0200 Subject: [PATCH] replace fp divisions by multiplications --- Util/MercatorUtil.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Util/MercatorUtil.h b/Util/MercatorUtil.h index aa019eca9..31d1139be 100644 --- a/Util/MercatorUtil.h +++ b/Util/MercatorUtil.h @@ -32,12 +32,12 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. inline float y2lat(const float a) { - return 180.f / static_cast(M_PI) * (2.f * std::atan(std::exp(a * static_cast(M_PI) / 180.f)) - static_cast(M_PI) / 2.f); + return 180.f * static_cast(M_1_PI) * (2.f * std::atan(std::exp(a * static_cast(M_PI) / 180.f)) - static_cast(M_PI_2)); } inline float lat2y(const float a) { - return 180.f / static_cast(M_PI) * std::log(std::tan(static_cast(M_PI) / 4.f + a * (static_cast(M_PI) / 180.f) / 2.f)); + return 180.f * static_cast(M_1_PI) * std::log(std::tan(static_cast(M_PI_4) + a * (static_cast(M_PI) / 180.f) / 2.f)); } #endif // MERCATOR_UTIL_H