You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 4674e66
Browse filesBrowse the repository at this point in the historyBrowse files
Keep evaluation's digits from 1e-100000 to 1e100000 (#2668) (#2674)
The default DecimalPrecisionContext had a hundred digits but exponents
from -100 to 1000 only. An exact part below 10^-100 became 0 as a decimal
and one past 10^1000 became +oo, so every digit built on it was wrong:
sqrt(1/10^200 + 1/10^210) * 10^100 was 0, exp(3000) * exp(-3000) was NaN,
and the exact roots Solve writes for an equation in 10^20 x evaluated to
points with a residual of 1.36. The range is now -100000 to 100000, both
ways, so that a number and its reciprocal are both held.
With the range open, three precision limits that the flush had hidden
showed, and are fixed with it:
- the sine, cosine and arctangent ran in fixed point, whose guard digits
are absolute, so below 10^-8 (10^-5 for the arctangent) they lost
digits and at 10^-200 gave 0; they are now summed as series in floating
point there;
- the reduction of a sine's argument by 2 pi used pi to the working
digits, so from 10^8 up it lost a digit per digit of the argument, and
sin(10^500) had none right; it is now reduced with pi to as many more
digits as the argument has, and an exact rational argument is written
out to that many digits;
- the Hermite reduction over two binomials of degree three or four was
declined only because its check overflowed. Over the range, its answer
to x^7 (a + b x^3)^(1/3)/(c + d x^3) is 23,030 characters, where the
cube root's rules give 2,861. It is now declined for that pair, as the
split by residues already declines it.
Tests changed because their answers got better: the flushed gamma parts
are asked for in a context ending at 1e-100, as the default did, with
the default's values pinned beside them; catalannumber(2000.5),
(1e600 + 1e600 i)^2 and three comparisons were +oo or stayed written, and
are now their values, mpmath's. The rows still past the range moved
past the new ends.
Widening the exponents let finite numbers past 1e1000 reach algorithms that
had only ever seen +oo there, and some of them work through the argument's
digits:
- e^x for a huge x was taken by PeterO's exponential, which works its way to
the overflow through a power of e as large as x, and inside ExpDifference
in a context with no exponent range. sinh(exp(10000)) took 38 s to be +oo,
and limitcheck went from 28 s to 44.5 s. Past ln 10 times the context's
ends, e^x is now +oo or 0 from x's size alone, and e^v (e^d - 1) is e^(v+d)
or -e^v once d is past them.
- erf, erfc, erfi, Ei, Si, Ci, Shi, Chi, the gamma function, a quotient of
factorials, polygamma off the real line, and the complex paths of exp, the
trigonometric functions and arcsin/arccos did not finish in 20 s at
10^5000, or lost every digit to their residual scales. sin(10^5000 + i) had
no imaginary part, and arcsin(10^5000) was 0. They take a part past 10^1000
as the infinity it was, so their answers there are master's.
- e to a complex power now goes through Exp, as e to a real power does: the
polar form multiplied the imaginary part by ln e's hundred digits, so
cosh(10^5000 i) was -0.86 where it is cos(10^5000), -0.73.
- zeta past a double's range counted its terms through doubles and threw on
a negative precision, which zeta(-10^900) did on master too. It is left as
written past a million.
Measured: limitcheck 27.7/28.0 s on master and 28.3/28.1 s here, with 2 more
cases compared and the same 0 wrong; sinh(exp(10000)) 38,604 ms -> 131 ms
in-process. Suite 21993 passed.
A decimal argument is known to the working digits, so reducing it by
2 pi leaves precision - k of them for an argument near 10^k. Past
10^(precision - 16) the sine and cosine were mostly noise:
cos(exp(300)) was 0.23 where it is -0.98. Widening the exponents let
values past 10^1000 reach the same reduction, so cos(exp(10000)),
which was NaN, became 0.31 where it is 0.92.
SinAndCos is now NaN for a decimal past that bound. An exact rational is
written out to the digits its reduction needs and goes through
SinAndCosOfAnExactArgument at any size, so cos(10^150 + 1/3) and
cos(10^150/3) are right. Si of such a decimal is +-pi/2, and Ei far up
the imaginary axis is +-i pi, where the oscillating part is below the
working digits.
Suite 22012 passed; limitcheck 27.4/27.9 s on master, 27.7/28.1 s here.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
| `exp(-1000.5) > exp(-3002.5)` | `False` | stays written |
87
-
| `exp(-2000) = exp(-2000.5)` | `True` | stays written |
147
+
| `exp(-1000.5) > exp(-3002.5)` | `False` | `True`, both sides within the exponents since [#2668](https://github.com/asc-community/AngouriMath/issues/2668) |
0 commit comments