|
Boost Users : |
From: Gero Peterhoff (g.peterhoff_at_[hidden])
Date: 2022-07-31 17:28:30
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
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net