MeteoSwiss-APN/dawn

`pow` only works if both arguments have the same type

BenWeber42 opened this issue · 0 comments

See:

/**
* @brief Raise @c x to power @c y.
*
* @param x Base value
* @param y Exponent value
*
* @see http://en.cppreference.com/w/cpp/numeric/math/fmod
*/
template <typename T>
GT_FUNCTION T pow(const T x, const T y) {
return ::pow(x, y);
}

Can lead to errors like:

intro_cxx-naive.cpp:37:89: error: no matching function for call to ‘pow(dawn::float_type, int)’
   37 |  gridtools::dawn::math::pow((::dawn::float_type) 2.0, (int) 1);

C++'s pow is defined for this case:
https://en.cppreference.com/w/cpp/numeric/math/pow