diff --git a/include/xsimd/arch/common/xsimd_common_math.hpp b/include/xsimd/arch/common/xsimd_common_math.hpp index 71dc75787..5962549c7 100644 --- a/include/xsimd/arch/common/xsimd_common_math.hpp +++ b/include/xsimd/arch/common/xsimd_common_math.hpp @@ -1694,9 +1694,15 @@ namespace xsimd #ifndef XSIMD_NO_INFINITIES batch_type zz = select(isnez, select(self == constants::infinity(), constants::infinity(), r), constants::minusinfinity()); #else - batch_type zz = select(isnez, r, constants::minusinfinity()); + assert(all(isnez) && "Calling log10 on a batch with zero value while XSIMD_NO_INFINITIES is active"); + batch_type zz = r; #endif +#ifndef XSIMD_NO_NANS return select(!(self >= batch_type(0.)), constants::nan(), zz); +#else + assert(all(self >= batch_type(0.)) && "Calling log10 on a batch with negative value while XSIMD_NO_NANS is active"); + return zz; +#endif } template @@ -2475,7 +2481,7 @@ namespace xsimd { using batch_type = batch; auto nan_result = (self < batch_type(0.) && is_flint(self)); -#ifndef XSIMD_NO_INVALIDS +#ifndef XSIMD_NO_NANS nan_result = isnan(self) || nan_result; #endif batch_type q = abs(self); diff --git a/include/xsimd/xsimd.hpp b/include/xsimd/xsimd.hpp index b5548e7ac..1ae9f5867 100644 --- a/include/xsimd/xsimd.hpp +++ b/include/xsimd/xsimd.hpp @@ -12,6 +12,12 @@ #ifndef XSIMD_HPP #define XSIMD_HPP +#if defined(__FAST_MATH__) +#define XSIMD_NO_DENORMALS +#define XSIMD_NO_INFINITIES +#define XSIMD_NO_NANS +#endif + #if defined(__has_cpp_attribute) // if this check passes, then the compiler supports feature test macros #if __has_cpp_attribute(nodiscard) >= 201603L