Fixed GCC conversion warning issued in erf and erfc functions with T=float

This commit is contained in:
Christian Godenschwager 2016-09-05 13:08:25 +02:00
parent 14248681cd
commit a636651f78
1 changed files with 32 additions and 2 deletions

View File

@ -1111,6 +1111,21 @@ namespace exprtk
return T(0);
}
inline float erf_dispatch( const float v )
{
return ::erff( v );
}
inline double erf_dispatch( const double v )
{
return ::erf( v );
}
inline long double erf_dispatch( const long double v )
{
return ::erfl( v );
}
template <typename T>
inline T erf_impl(T v, real_type_tag)
{
@ -1135,7 +1150,7 @@ namespace exprtk
return (v >= T(0)) ? result : -result;
#else
return ::erf(v);
return erf_dispatch( v );
#endif
}
@ -1144,6 +1159,21 @@ namespace exprtk
{
return erf_impl(static_cast<double>(v),real_type_tag());
}
inline float erfc_dispatch( const float v )
{
return ::erfcf( v );
}
inline double erfc_dispatch( const double v )
{
return ::erfc( v );
}
inline long double erfc_dispatch( const long double v )
{
return ::erfcl( v );
}
template <typename T>
inline T erfc_impl(T v, real_type_tag)
@ -1151,7 +1181,7 @@ namespace exprtk
#if defined(_WIN32) || defined(__WIN32__) || defined(WIN32)
return T(1) - erf_impl(v,real_type_tag());
#else
return ::erfc(v);
return erfc_dispatch( v );
#endif
}