Skip to content

Bug/1116 #1117

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions include/xsimd/arch/common/xsimd_common_math.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1694,9 +1694,15 @@ namespace xsimd
#ifndef XSIMD_NO_INFINITIES
batch_type zz = select(isnez, select(self == constants::infinity<batch_type>(), constants::infinity<batch_type>(), r), constants::minusinfinity<batch_type>());
#else
batch_type zz = select(isnez, r, constants::minusinfinity<batch_type>());
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<batch_type>(), 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 <class A>
Expand Down Expand Up @@ -2475,7 +2481,7 @@ namespace xsimd
{
using batch_type = batch<T, A>;
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);
Expand Down
6 changes: 6 additions & 0 deletions include/xsimd/xsimd.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down