Use std::fpclassify for double==0 tests

This commit is contained in:
Roy Stogner 2022-03-16 08:35:34 -05:00
parent 19ec7c78a1
commit 30279f701c
1 changed files with 2 additions and 1 deletions

View File

@ -71,7 +71,8 @@ Orientation Orient2d(const Point& pa, const Point& pb, const Point& pc)
// Using a tolerance here fails on concave-by-subepsilon boundaries
// if (val > -EPSILON && val < EPSILON) {
if (val == 0) {
// Using == on double makes -Wfloat-equal warnings yell at us
if (std::fpclassify(val) == FP_ZERO) {
return COLLINEAR;
} else if (val > 0) {
return CCW;