About Floating-point Number Equalities
Floating point operations are inaccurate because of the nature of computer architecture. Instead of equality, check proximity:
1 2 3 4 |
|
Here
rtol
is relative tolerance.atol
is absolute tolerance.abs(x)
returns absolute value |x| (x without a negative sign).max(*args)
returns the largest argument.
To clarify the notation used in the function:
1 2 |
|
Also by me
Django Paddle Subscriptions app
For Django-based SaaS projects.
Django App for You
Django GDPR Cookie Consent app
For Django websites that use cookies.
Django App for You