move geographical distance computation to floats

This commit is contained in:
Dennis Luxen
2014-05-21 12:33:54 +02:00
parent a8ff3231a8
commit 493b13364f
5 changed files with 103 additions and 191 deletions
+6 -4
View File
@@ -28,16 +28,18 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef MERCATOR_UTIL_H
#define MERCATOR_UTIL_H
#include "SimpleLogger.h"
#include <cmath>
inline double y2lat(const double a)
inline float y2lat(const float a)
{
return 180. / M_PI * (2. * atan(exp(a * M_PI / 180.)) - M_PI / 2.);
return 180.f / M_PI * (2.f * std::atan(std::exp(a * M_PI / 180.f)) - M_PI / 2.f);
}
inline double lat2y(const double a)
inline float lat2y(const float a)
{
return 180. / M_PI * log(tan(M_PI / 4. + a * (M_PI / 180.) / 2.));
return 180.f / M_PI * log(tan(M_PI / 4.f + a * (M_PI / 180.f) / 2.f));
}
#endif // MERCATOR_UTIL_H