Ejemplo n.º 1
0
 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)
Ejemplo n.º 2
0
 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)
Ejemplo n.º 3
0
 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)
Ejemplo n.º 4
0
 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)