31 Jul
2022
31 Jul
'22
5:28 p.m.
Hi John, i think your sign-function (boost/math/special_functions/sign.hpp) is incomplete. Because the resulttype is int, not all cases can be covered correctly (nan, inf, -0). With my implementation this works and it follows the std-conventions (sgn(FP) -> FP, sgn(INT/BOOL) -> double). I also tried to optimize them (branch-free, vectorizable). sgn(FP) -> FP ±0/±1 sgn(FP nan/inf) -> FP nan/inf sgn(INT) -> double +0/±1 sgn(UINT/BOOL) -> double +0/+1 regards Gero
849
Age (days ago)
849
Last active (days ago)
0 comments
1 participants
participants (1)
-
Gero Peterhoff