Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions interval/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,14 @@ def __pos__(self):
def __neg__(self):
return self.new(self.Component(-x.sup, -x.inf) for x in self)

@comp_by_comp
def min(x, y):
return (fpu.down(lambda: min(x.inf, y.inf)), fpu.up(lambda: min(x.sup, y.sup)))

@comp_by_comp
def max(x, y):
return (fpu.down(lambda: max(x.inf, y.inf)), fpu.up(lambda: max(x.sup, y.sup)))

@comp_by_comp
def __add__(x, y):
return (fpu.down(lambda: x.inf + y.inf), fpu.up(lambda: x.sup + y.sup))
Expand Down