Skip to content

Commit 03d48b5

Browse files
Fix log10 implementation under -ffast-math
Fix #1116
1 parent 178312d commit 03d48b5

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

include/xsimd/arch/common/xsimd_common_math.hpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1694,9 +1694,15 @@ namespace xsimd
16941694
#ifndef XSIMD_NO_INFINITIES
16951695
batch_type zz = select(isnez, select(self == constants::infinity<batch_type>(), constants::infinity<batch_type>(), r), constants::minusinfinity<batch_type>());
16961696
#else
1697-
batch_type zz = select(isnez, r, constants::minusinfinity<batch_type>());
1697+
assert(all(isnez) && "Calling log10 on a batch with zero value while XSIMD_NO_INFINITIES is active");
1698+
batch_type zz = r;
16981699
#endif
1700+
#ifndef XSIMD_NO_NANS
16991701
return select(!(self >= batch_type(0.)), constants::nan<batch_type>(), zz);
1702+
#else
1703+
assert(all(self >= batch_type(0.)) && "Calling log10 on a batch with negative value while XSIMD_NO_NANS is active");
1704+
return zz;
1705+
#endif
17001706
}
17011707

17021708
template <class A>
@@ -2475,7 +2481,7 @@ namespace xsimd
24752481
{
24762482
using batch_type = batch<T, A>;
24772483
auto nan_result = (self < batch_type(0.) && is_flint(self));
2478-
#ifndef XSIMD_NO_INVALIDS
2484+
#ifndef XSIMD_NO_NANS
24792485
nan_result = isnan(self) || nan_result;
24802486
#endif
24812487
batch_type q = abs(self);

0 commit comments

Comments
 (0)