#ifndef __AMSCUMATH_HPP__
#define __AMSCUMATH_HPP__

namespace amscuda
{



    //Problem: These are not in the namespace
    //#define nan NAN
    //#define fnan (float) NAN
    //#define inf INFINITY
    //#define finf (float) INFINITY
    //#define pi 3.1415926535897936

    //These need to be the same symbol for both host and device code
    AMSCU_CONST static const double nan = NAN;
    AMSCU_CONST static const float fnan = (float) NAN;
    AMSCU_CONST static const double inf = INFINITY;
    AMSCU_CONST static const float finf = (float) INFINITY;
    AMSCU_CONST static const double pi = 3.1415926535897936;
    AMSCU_CONST static const float pif = 3.1415926535897936;

    __host__ __device__ double dabs(double x);
    __host__ __device__ float fabs(float x);
    
    template<typename T> __host__ __device__ T abs(const T in)
    {
        T ret = in;
        if(in<0) ret = -in;
        return ret;
    }

    __host__ __device__ double mod(double a, double md);
    __host__ __device__ float mod(float a, float md);
    __host__ __device__ int mod(int x, int n);
    __host__ __device__ long mod(long x, long n);

    __host__ __device__ int truediv(int x, int y);
    __host__ __device__ long truediv(long x, long y);

    template<typename T> __host__ __device__ T min(T a, T b);
    template<typename T> __host__ __device__ T max(T a, T b);

    __device__ __host__ double arg(double x, double y);
    __device__ __host__ void get_azel(double x, double y, double z, double *az, double *el);

    void test_amscumath1();


}; //end namespace amscuda

#include <amsculib2/amscumath_impl.hpp>

#endif

