def cmp_(self, i): a = float(i) t = s(i)[0] + s(i).replace("+", "e+")[1:].replace("-", "e-", 1) b = float(t) self.assertTrue((a - b) / a < 0.05) self.assertTrue(len(s(i)) <= 8)
def cmp_(self, i): a = float(i) t = s(i)[0] + s(i).replace("+", "e+")[1:].replace("-", "e-", 1) b = float(t) self.assertTrue((a-b)/a < 0.05) self.assertTrue(len(s(i)) <= 8)
def test_interesting_inputs(self): for i in inputs: pos = s(i) neg = s(-i) self.cmp_(i) self.cmp_(-i)