Lines Matching refs:approx_equal

76 def approx_equal(x, y, tol=1e-12, rel=1e-7):  function
242 if approx_equal(first, second, tol, rel):
310 self.assertTrue(approx_equal(a, b, tol=0, rel=rel))
311 self.assertTrue(approx_equal(b, a, tol=0, rel=rel))
339 flag1 = approx_equal(a, b, tol, rel)
340 flag2 = approx_equal(b, a, tol, rel)
351 result = approx_equal(x, x, tol=tol, rel=rel)
353 result = approx_equal(-x, -x, tol=tol, rel=rel)
414 result = approx_equal(a, a+1, tol=0, rel=0)
449 self.assertTrue(approx_equal(x, y, tol=2*delta, rel=0), msg)
450 self.assertFalse(approx_equal(x, y, tol=delta/2, rel=0), msg)
482 self.assertTrue(approx_equal(1e-5, -1e-5, tol=1e-4, rel=0))
490 self.assertTrue(approx_equal(x, y, tol=0, rel=2*delta), msg)
491 self.assertFalse(approx_equal(x, y, tol=0, rel=delta/2), msg)
495 self.assertTrue(approx_equal(64, 47, tol=0, rel=0.36))
496 self.assertTrue(approx_equal(64, 47, tol=0, rel=0.37))
498 self.assertTrue(approx_equal(449, 512, tol=0, rel=0.125))
499 self.assertTrue(approx_equal(448, 512, tol=0, rel=0.125))
500 self.assertFalse(approx_equal(447, 512, tol=0, rel=0.125))
533 check(approx_equal(a, b, tol=tol, rel=0))
535 check(approx_equal(a, b, tol=0, rel=rel))
537 check(approx_equal(a, b, tol=tol, rel=rel))
564 self.assertTrue(approx_equal(inf, inf))
565 self.assertTrue(approx_equal(inf, inf, 0, 0))
566 self.assertTrue(approx_equal(inf, inf, 1, 0.01))
567 self.assertTrue(approx_equal(-inf, -inf))
568 self.assertFalse(approx_equal(inf, -inf))
569 self.assertFalse(approx_equal(inf, 1000))
575 self.assertFalse(approx_equal(nan, other))
579 self.assertTrue(approx_equal(nzero, 0.0, tol=0.1, rel=0.1))
583 self.assertTrue(approx_equal(nzero, Decimal(0), tol=0.1, rel=0.1))
591 self.assertRaises(ValueError, approx_equal, 100, 100, -1, 0.1)
595 self.assertRaises(ValueError, approx_equal, 100, 100, 1, -0.1)