#PCBBAY0000008. Kiểm tra gần 0 theo epsilon (Near-Zero Comparison)
Kiểm tra gần 0 theo epsilon (Near-Zero Comparison)
Near-Zero Comparison
Version: Phuoc Hung OJ Extended
Problem Statement
Given a real number and a nonnegative absolute tolerance , decide whether is close to zero by testing . This is the result of Python 3 math.isclose(x, 0.0, rel_tol=0.0, abs_tol=eps).
Input
The only line contains real number and absolute tolerance , in that order.
Output
Print exactly True if , otherwise False.
Subtasks
- Subtask 1 (100 points): are finite and .
Examples
Example 1
Input
1e-10 1e-09
Output
True
Explanation. The computed difference is approximately 1e-10 and the permitted tolerance is 1e-09. The difference is ≤ the tolerance, so the answer is True.
Example 2
Input
1e-06 1e-09
Output
False
Explanation. The computed difference is approximately 1e-06 and the permitted tolerance is 1e-09. The difference is > the tolerance, so the answer is False.
Example 3
Input
0 1e-12
Output
True
Explanation. The computed difference is approximately 0 and the permitted tolerance is 1e-12. The difference is ≤ the tolerance, so the answer is True.