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:
parent
242eb5f2fe
commit
94287a9288
|
@ -230,7 +230,7 @@ consideration, for instance:
|
||||||
|
|
||||||
4) The absolute value of the arithmetic mean of the two
|
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.
|
values, a and b, are close to each other.
|
||||||
|
|
||||||
1) ``abs(a-b) <= tol*abs(a)``
|
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) )``
|
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:
|
NOTE: (2) and (3) can also be written as:
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue