from math import isclose, isfinite def gan_dung(thuc_te, ky_vong): return isfinite(thuc_te) and isfinite(ky_vong) and isclose(thuc_te, ky_vong, rel_tol=0, abs_tol=0.1) a, b, c = 0, 0.09, 0.18 assert gan_dung(a, b) and gan_dung(b, c) assert not gan_dung(a, c) assert not isclose(0, 1e-12, rel_tol=0.01, abs_tol=0) assert isclose(0, 1e-12, rel_tol=0.01, abs_tol=1e-10) assert not gan_dung(float("nan"), 0) assert not gan_dung(float("inf"), float("inf")) print("Gần đúng không bắc cầu. Sai số tuyệt đối cần thiết khi kỳ vọng gần 0.")