#PCBBAY0000002. So sánh gần đúng với mặc định (Default Approximate Comparison)
So sánh gần đúng với mặc định (Default Approximate Comparison)
Default Approximate Comparison
Version: Phuoc Hung OJ Extended
Problem Statement
Two real numbers and may differ slightly because of floating-point representation. Determine whether they are approximately equal under Python 3 math.isclose(a, b) with the defaults rel_tol=1e-9 and abs_tol=0.0. The test is .
Input
The only line contains real numbers and , in that order.
Output
Print exactly True if the numbers are close under the default rule; otherwise print exactly False (case-sensitive).
Subtasks
- Subtask 1 (100 points): are finite.
Examples
Example 1
Input
0.30000000000000004 0.3
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
Output
True
Explanation. The computed difference is approximately 1.00000008274e-10 and the permitted tolerance is 1.0000000001e-09. The difference is ≤ the tolerance, so the answer is True.
Example 3
Input
1000 1000.01
Output
False
Explanation. The computed difference is approximately 0.00999999999999 and the permitted tolerance is 1.00001e-06. The difference is > the tolerance, so the answer is False.