Skip to content

Commit

Permalink
Complete 'less_than' function
Browse files Browse the repository at this point in the history
  • Loading branch information
lycantropos committed Dec 7, 2020
1 parent 6b3f4cb commit 6792fdf
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions sect/core/voronoi/events/models.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import sys
from typing import TypeVar

from reprit.base import generate_repr
Expand All @@ -7,7 +6,8 @@

from sect.core.voronoi.enums import SourceCategory
from sect.core.voronoi.hints import Source
from sect.core.voronoi.utils import are_same_vertical_points
from sect.core.voronoi.utils import (_float_to_uint,
are_same_vertical_points)
from sect.hints import (Coordinate,
Point)

Expand Down Expand Up @@ -125,5 +125,7 @@ def deactivate(self) -> None:

def less_than(left: Coordinate, right: Coordinate,
*,
tolerance: float = 64 * sys.float_info.epsilon) -> bool:
return left + tolerance < right
max_ulps: int = 64) -> bool:
return (max_ulps < _float_to_uint(left) - _float_to_uint(right)
if isinstance(left, float) and isinstance(right, float)
else left < right)

0 comments on commit 6792fdf

Please sign in to comment.