Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions BREAKING-CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,43 @@ reciprocals for `k` up to 120, and at moderate and large arguments, master had 3
branch has none, and 563 changed, all of them `a` below `10^(-2)`. The last digit of some printed values moves, and an
imaginary value whose digits past the first are all 0 prints short: `arcsch(10^200 * i)` is `-1E-200i`.

### arcosh, arsech, artanh and arcoth near their zero keep all their digits

**Silent: wrong numbers become right ones.** `arcosh(a)` is `ln(a + sqrt(a + 1) sqrt(a - 1))`, about
`ln(1 + sqrt(2 (a - 1)))` near 1, and the sum near 1 kept the working digits of 1 rather than of the root, so the
logarithm lost as many digits as `sqrt(a - 1)` is below 1. From `a - 1` below `10^(-100)` the sum is within `10^(-50)` of
1, the downcasting took it for 1, and the answer was 0. A complex `a` near 1 had a part within `10^(-50)` of 1 taken for 1
the same way: `arsech(1 + 10^(-30) i)` evaluates `1/(1 + 10^(-30) i)`, whose real part `1 - 10^(-60)` was 1. `artanh(x)`
is `ln((1 + x)/(1 - x))/2`, and the quotient near 1 was rounded at the working digits, losing up to as many digits as
`x` is below 1 -- 80 of `artanh(10^(-20))`, 75 of `artanh(10^(-25))` -- until the logarithm near 1 evaluated again with
more digits took over below that. The logarithm is now taken as
`ln(1 + u)`, with `u = (a - 1) + sqrt(a + 1) sqrt(a - 1)` for `a` within about `10^(-2)` of 1, `a` evaluated again without
the downcasting where it is not rational, and with `u = 2x / (1 - x)` for `x` below about `10^(-2)`; `arsech(y)` and
`arcoth(y)` are the same logarithms of `1/y`. Near -1, `arcosh` and `arsech` are taken the same way, as `ln(-(1 + u))`. The
logarithm of a rational within about `10^(-2)` of 1 is taken from its distance from 1, which is exact. Measured on master
(70b17bba4, which differs from 3ccf893f2 by #2688 only) and on this branch; the true values are mpmath's at 700 digits
([#2689](https://github.com/asc-community/AngouriMath/issues/2689)).

| `.Evaled` | Was (master) | Now |
|---|---|---|
| `arcosh(1 + 10^(-20))` | `1.414213562373095048800510…875687239457891844E-10`, right to 89 digits | `1.414213562373095048800510…875687241607101855E-10` |
| `arcosh(1 + 10^(-40))` | `1.414213562373095048801688…644977927549584108301E-20`, right to 79 digits | `1.414213562373095048801688…625183257769371987089E-20` |
| `arcosh(1 + 10^(-120))` | `0` | `1.414213562373095048801688724209698…E-60` |
| `arsech(1 - 10^(-120))` | `0` | `1.414213562373095048801688724209698…E-60` |
| `arsech(1 + 10^(-30) * i)` | `1.000000000000000000000000000000083333…E-15 - 9.999…99916666…i`, right to 30 digits | `9.99999999999999999999999999999583333…E-16 - 1.000000000000000000000000000000416666…E-15i` |
| `artanh(10^(-20))` | `1.000…0333…3333325333333333333333334E-20`, right to 80 digits | `1.000…0333…3333335333333333333333333E-20` |
| `arcoth(10^20)` | `1.000…0333…3333325333333333333333334E-20`, right to 80 digits | `1.000…0333…3333335333333333333333333E-20` |
| `arcosh(-1 - 10^(-120))` | `3.14159…i`, the real part `1.414…E-60` missing | `1.414213562373095048801688724209698…E-60 + 3.14159…i` |

Of 4059 sampled values of the four functions and of the logarithm of a rational near 1, at `1 ± 10^(-k)`, `1 + 10^(-k) + 10^(-k-3)/3`, `1 ± 10^(-k) i` and
`1 + 10^(-k) (±1 + i)` for `arcosh` and `arsech`, at `-1 - 10^(-k)` and `-1 + 10^(-k)`, at `±10^(-k)`, `±10^(-k) i` and
`±10^(-k) (1 + i)` for `artanh` and their reciprocals for `arcoth`, for `k` from 1 to 240, and at moderate, large and
branch-cut arguments, master had 1204 wrong past a relative `1e-95`; this branch has 11, which are `artanh` of a real above
1 and `arcoth` of a real between -1 and 1 and are master's values unchanged: their imaginary part is `pi/2` with the sign
the logarithm of a negative number gives, where mpmath takes the other side of the cut. `artanh(1)` and `arcoth(1)` are
NaN and `artanh(-1)` and `arcoth(-1)` are `-oo`, on both. The last digit of some printed
values moves, and a real part that is 0 on the unit circle, `arcosh(1 - 10^(-30))` among them, stays 0.

### A number past the working digits is not taken for an exact one

**Not silent: wrong answers become exact ones.** At the default hundred digits, a product past about `10^50`
Expand Down
Loading
Loading