#PCBBAY0000004. So sánh theo dung sai tương đối (Relative-Tolerance Comparison)
So sánh theo dung sai tương đối (Relative-Tolerance Comparison)
Relative-Tolerance Comparison
Version: Phuoc Hung OJ Extended
Problem Statement
Given real numbers , and a relative tolerance , regard them as close when . Use the semantics of Python 3 math.isclose(a, b, rel_tol=eps, abs_tol=0.0). There is no additional absolute tolerance near zero.
Input
The only line contains real numbers , and relative tolerance , in that order.
Output
Print exactly True if , otherwise False.
Subtasks
- Subtask 1 (100 points): are finite; .
Examples
Example 1
Input
0.30000000000000004 0.3 1e-09
Output
True
Explanation. The computed difference is approximately 5.55111512313e-17 and the permitted tolerance is 3e-10. The difference is ≤ the tolerance, so the answer is True.
Example 2
Input
1 1.0000000001 1e-08
Output
True
Explanation. The computed difference is approximately 1.00000008274e-10 and the permitted tolerance is 1.0000000001e-08. The difference is ≤ the tolerance, so the answer is True.
Example 3
Input
1000 1000.01 0.0001
Output
True
Explanation. The computed difference is approximately 0.00999999999999 and the permitted tolerance is 0.100001. The difference is ≤ the tolerance, so the answer is True.