Skip to content

Commit 83d2ae7

Browse files
authored
Merge pull request #1020 from JohanMabille/signbit_scalar
Fix scalar version of signbit
2 parents 59c407d + 8785d8d commit 83d2ae7

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

include/xsimd/arch/xsimd_scalar.hpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -825,6 +825,21 @@ namespace xsimd
825825
return T(x < T(0));
826826
}
827827

828+
XSIMD_INLINE float bitofsign(float const& x) noexcept
829+
{
830+
return float(std::signbit(x));
831+
}
832+
833+
XSIMD_INLINE double bitofsign(double const& x) noexcept
834+
{
835+
return double(std::signbit(x));
836+
}
837+
838+
XSIMD_INLINE long double bitofsign(long double const& x) noexcept
839+
{
840+
return static_cast<long double>(std::signbit(x));
841+
}
842+
828843
template <class T>
829844
XSIMD_INLINE auto signbit(T const& v) noexcept -> decltype(bitofsign(v))
830845
{

0 commit comments

Comments
 (0)