Fixed GCC conversion warning issued in erf and erfc functions with T=float
This commit is contained in:
parent
14248681cd
commit
a636651f78
34
exprtk.hpp
34
exprtk.hpp
|
@ -1111,6 +1111,21 @@ namespace exprtk
|
||||||
return T(0);
|
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>
|
template <typename T>
|
||||||
inline T erf_impl(T v, real_type_tag)
|
inline T erf_impl(T v, real_type_tag)
|
||||||
{
|
{
|
||||||
|
@ -1135,7 +1150,7 @@ namespace exprtk
|
||||||
|
|
||||||
return (v >= T(0)) ? result : -result;
|
return (v >= T(0)) ? result : -result;
|
||||||
#else
|
#else
|
||||||
return ::erf(v);
|
return erf_dispatch( v );
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1145,13 +1160,28 @@ namespace exprtk
|
||||||
return erf_impl(static_cast<double>(v),real_type_tag());
|
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>
|
template <typename T>
|
||||||
inline T erfc_impl(T v, real_type_tag)
|
inline T erfc_impl(T v, real_type_tag)
|
||||||
{
|
{
|
||||||
#if defined(_WIN32) || defined(__WIN32__) || defined(WIN32)
|
#if defined(_WIN32) || defined(__WIN32__) || defined(WIN32)
|
||||||
return T(1) - erf_impl(v,real_type_tag());
|
return T(1) - erf_impl(v,real_type_tag());
|
||||||
#else
|
#else
|
||||||
return ::erfc(v);
|
return erfc_dispatch( v );
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue