Skip to content

Commit

Permalink
Bug fix: Use copysign() to get the proper inverse value
Browse files Browse the repository at this point in the history
  • Loading branch information
madmann91 committed Dec 15, 2020
1 parent 3b2f3d0 commit 354de26
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion include/bvh/vector.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ struct Vector {
bvh__always_inline__ Vector safe_inverse() const {
static constexpr auto threshold = std::numeric_limits<Scalar>::epsilon();
return Vector([&] (size_t i) {
return Scalar(1) / (std::fabs(values[i]) < threshold ? threshold : values[i]);
return Scalar(1) / (std::fabs(values[i]) < threshold ? std::copysign(threshold, values[i]) : values[i]);
});
}

Expand Down

0 comments on commit 354de26

Please sign in to comment.