Skip to content

Commit

Permalink
Merge pull request #901 from JohanMabille/warn_eq
Browse files Browse the repository at this point in the history
back to slow implementation of exp10 on Windows on Windows
  • Loading branch information
JohanMabille committed Feb 2, 2023
2 parents e9d3c17 + 0428596 commit ebc5500
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 11 deletions.
13 changes: 6 additions & 7 deletions include/xsimd/arch/xsimd_scalar.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -459,14 +459,13 @@ namespace xsimd
{
return ::exp10(x);
}
#elif defined(__MINGW32__)
inline float exp10(const float& x) noexcept
{
return std::exp((float)(2.30258509F * (x)));
}
inline double exp10(const double& x) noexcept
#elif defined(_WIN32)
template <class T, class = typename std::enable_if<std::is_scalar<T>::value>::type>
inline T exp10(const T& x) noexcept
{
return std::exp((double)(2.30258509299404568402 * (x)));
// Very inefficient but other implementations give incorrect results
// on Windows
return std::pow(T(10), x);
}
#else
inline float exp10(const float& x) noexcept
Expand Down
4 changes: 0 additions & 4 deletions test/test_xsimd_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -463,11 +463,7 @@ struct xsimd_api_float_types_functions
void test_exp10()
{
value_type val(2);
#ifndef _WIN32
CHECK_EQ(extract(xsimd::exp10(T(val))), std::pow(value_type(10), val));
#else
WARN_EQ(extract(xsimd::exp10(T(val))), std::pow(value_type(10), val));
#endif
}
void test_exp2()
{
Expand Down

0 comments on commit ebc5500

Please sign in to comment.