/*
 * Copyright 2015 Telenav Inc. All rights reserved.
 */
#ifndef TN_FOUNDATION_MATH_HPP
#define TN_FOUNDATION_MATH_HPP
#ifdef __cplusplus

#include "foundation/cxx11compat.hpp"

#if _TN_FOUNDATION_USE_STD_MATH
#  include <cmath>
#else
#  include "boost/math/special_functions/fpclassify.hpp"
#  include "boost/math/special_functions/round.hpp"
#  define _TN_FOUNDATION_MATH_NS ::boost::math
#endif 

namespace tn {
    using _TN_FOUNDATION_STD_MATH_NS::isnan;
    using _TN_FOUNDATION_STD_MATH_NS::isinf;
    
#if TN_PLATFORM_ANDROID && _TN_FOUNDATION_USE_STD && _GLIBCXX_CMATH
    // GNU's implementation of STL on Android does not pull round functions to std:: namespace
    // by default
    using ::round;
    using ::lround;
    using ::llround;    
#else
    using _TN_FOUNDATION_MATH_NS::round;
    using _TN_FOUNDATION_MATH_NS::lround;
    using _TN_FOUNDATION_MATH_NS::llround;
#endif
}

#endif /* __cplusplus */

#ifndef M_PI
#  define M_PI 3.14159265358979323846
#endif

#ifndef M_PI_2
#  define M_PI_2  1.57079632679489661923
#endif


#endif /* TN_FOUNDATION_MATH_HPP */
