def __call__(self, a, b): delta = self.rel_error * a lb = a - delta ub = a + delta res = lb <= b <= ub desc = 'Condition checked:\n %s <= %s <= %s.' % (lb, b, ub) return ResultWithDescription(res, desc)
def __call__(self, a, b): delta = self.rel_error * a lb = a - delta ub = a + delta res = lb <= b <= ub desc = f"Condition checked:\n {lb} <= {b} <= {ub}." return ResultWithDescription(res, desc)
def __call__(self, a, b): try: expect_float(a) expect_float(b) val = self.f(a, b) desc = '%s %s %s' % (a, self.which, b) return ResultWithDescription(val, desc) except EvaluationError as e: msg = 'While evaluating %s(%s, %s)' % (self.f.__name__, a, b) dtu.raise_wrapped(EvaluationError, e, msg, compact=True)
def __call__(self, a, b): try: expect_float(a) expect_float(b) val = self.f(a, b) desc = f"{a} {self.which} {b}" return ResultWithDescription(val, desc) except EvaluationError as e: msg = f"While evaluating {self.f.__name__}({a}, {b})" dtu.raise_wrapped(EvaluationError, e, msg, compact=True)