Skip to content

Commit

Permalink
Dropping infinity usage
Browse files Browse the repository at this point in the history
  • Loading branch information
zaeta17 committed Oct 17, 2023
1 parent 71c28ed commit f9b1a2e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 11 deletions.
13 changes: 3 additions & 10 deletions octree.h
Original file line number Diff line number Diff line change
Expand Up @@ -318,15 +318,11 @@ namespace OrthoTree
auto& ptMin = base::box_min(ext);
auto& ptMax = base::box_max(ext);

autoce inf = std::numeric_limits<geometry_type>::has_infinity
? std::numeric_limits<geometry_type>::infinity()
: std::numeric_limits<geometry_type>::max()
;
LOOPIVDEP
for (dim_type iDimension = 0; iDimension < nDimension; ++iDimension)
{
base::point_comp(ptMin, iDimension) = +inf;
base::point_comp(ptMax, iDimension) = -inf;
base::point_comp(ptMin, iDimension) = std::numeric_limits<geometry_type>::max();
base::point_comp(ptMax, iDimension) = std::numeric_limits<geometry_type>::lowest();
}

return ext;
Expand Down Expand Up @@ -1788,10 +1784,7 @@ namespace OrthoTree
static geometry_type getFarestDistance(multiset<EntityDistance>& setEntity, size_t k) noexcept
{
if (setEntity.size() < k)
return std::numeric_limits<geometry_type>::has_infinity
? std::numeric_limits<geometry_type>::infinity()
: std::numeric_limits<geometry_type>::max()
;
return std::numeric_limits<geometry_type>::max();

return std::next(std::begin(setEntity), k - 1)->distance;
}
Expand Down
2 changes: 1 addition & 1 deletion unittests/general.tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ namespace Microsoft {

namespace
{
autoce BB1_INV = BoundingBox1D{ std::numeric_limits<double>::infinity(), -std::numeric_limits<double>::infinity() };
autoce BB1_INV = BoundingBox1D{ std::numeric_limits<double>::max(), std::numeric_limits<double>::lowest() };

static bool AreEqualAlmost(double l, double r) noexcept
{
Expand Down

0 comments on commit f9b1a2e

Please sign in to comment.