PEP 485: Fix relative difference formula (#2909)

* PEP 485: Fix relative difference formula

The formula did not work correctly for negative (a+b) values.

* PEP 485: Fix grammatical typo

Grammatical typo close to the formula typo.
This commit is contained in:
Václav Brožík 2022-12-03 20:59:14 +01:00 committed by GitHub
parent 242eb5f2fe
commit 94287a9288
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -230,7 +230,7 @@ consideration, for instance:
4) The absolute value of the arithmetic mean of the two
These leads to the following possibilities for determining if two
These lead to the following possibilities for determining if two
values, a and b, are close to each other.
1) ``abs(a-b) <= tol*abs(a)``
@ -239,7 +239,7 @@ values, a and b, are close to each other.
3) ``abs(a-b) <= tol * min( abs(a), abs(b) )``
4) ``abs(a-b) <= tol * (a + b)/2``
4) ``abs(a-b) <= tol * abs(a + b)/2``
NOTE: (2) and (3) can also be written as: