| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
| |
|
| |
|
|
|
|
|
| |
supports all None default values present in decimal.py. These values were
largely undocumented.
|
| |
|
| |
|
| |
|
|
|
|
| |
from a Decimal argument.
|
| |
|
| |
|
|\ |
|
| | |
|
|/
|
|
| |
supported in ANSI C
|
|
|
|
| |
prec=9 test is used.
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
| |
constructing infinities. This is done for backwards compatibility
with decimal.py: Infinity coefficients are undefined in _decimal
(in accordance with the specification).
|
| |
|
|
|
|
| |
decimal.py. The hack to remove the ideal exponent is no longer required.
|
| |
|
|
|
|
|
|
| |
had a coefficient with MAX_PREC=425000000 digits and a negative exponent.
Increasing the context limits above the official values fixes the issue
and is safe (in this case!).
|
|
|
|
|
|
|
|
|
|
| |
required for a corner case in dec_hash() in the following commit and also
usually faster. dec_hash() needs some extra precision above MPD_MAX_PREC,
and _mpd_base_ndivmod() is not audited for that.
2) Use _mpd_basemul() if the length of the smaller operand is less than
or equal to 256. While this is technically an optimization, it is
required for *testing* corner cases in dec_hash() in reasonable time.
|
|
|
|
|
| |
form is used in many places in the source tree, but was found to be incorrect
in a recent tracker discussion.
|
| |
|
|
|
|
| |
algorithm from decimal.py for mpd_qsqrt().
|
| |
|
|
|
|
|
|
| |
None of the _mpd_shortadd() or _mpd_shortmul() functions read uninitialized
values. Previously zeroing was required since _mpd_real_size() was called
on the output array.
|
|
|
|
|
|
|
|
|
|
| |
use log10() to calculate the size of the output array. The current code
has been tested on x86/amd64 (and to a lesser extent on qemu-mips qemu-sparc)
and produces sufficiently large values for all inputs tested so far (coefficient
sizes of 10**18 - 1 are hard to test exhaustively).
The new code does not rely on the correctness of log10() and resizes
the output arrays if the allocated space is insufficient.
|
| |
|
|
|
|
| |
only once (float obviously doesn't set any context at all).
|
|
|
|
|
| |
that was last accessed. In the pi benchmark (64-bit platform, prec=9),
_decimal is now only 1.5x slower than float.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
1) _mpd_qdivmod() uses the context precision only in two places, and
the new code should be exactly equivalent to the previous code.
2) Remove misleading comment.
3) The quotient *is* an integer with exponent 0, so calling mpd_qtrunc()
is pointless.
4) Replace two instances of identical code by a single one.
5) Use _mpd_cmp_abs() instead of mpd_cmp_total_mag(): the operands
are not special.
6) Don't clear MPD_Rounded in the status (with the current code it should
not be set within the function).
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
2) _mpd_qpow_mpd(): Abort the loop for all specials, not only infinity.
3) _mpd_qpow_mpd(): Make the function more general and distinguish between
zero clamping and folding down the exponent. The latter case is currently
handled by setting context->clamp to 0 before calling the function.
4) _mpd_qpow_int(): Add one to the work precision in case of a negative
exponent. This is to get the same relative error (0.1 * 10**-prec)
for both positive and negative exponents. The previous relative
error for negative exponents was (0.2 * 10**-prec).
Both errors are _before_ the final rounding to the context precision.
|
|
|
|
|
|
|
|
| |
2) Abort the loop for all specials, not only infinity.
3) Make the function more general and distinguish between zero clamping
and folding down the exponent. The latter case is currently handled
by setting context->clamp to 0 before calling the function.
|
|
|
|
|
| |
2) Remove micro optimization (inline checking for NaN before calling
mpd_qcheck_nans()) that probably has no benefit in this case.
|
|
|
|
|
| |
2) Switch argument order to match the function signature of mpd_calloc()
(cosmetic change, since the order is irrelevant).
|
| |
|
| |
|
|
|
|
|
|
|
| |
2) Add rigorous error analysis to _mpd_qlog10 (ACL2 proofs exist).
3) Use the relative error as a basis for the interval generation in the
correction loop (same as in _mpd_qln()).
|
|
|
|
|
|
|
| |
List all of them in the comment.
2) Use the recently stated relative error of _mpd_qln() to generate the
interval for the exact value of ln(x). See also the comment in mpd_qexp().
|
|
|
|
| |
2) Simplify the precision adjustment code for values in [0.900, 1.15].
|
|
|
|
| |
but this is more readable.
|
|
|
|
| |
in the simple path (not correctly rounded but faster).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Underflow to zero hasn't changed: _mpd_qexp() internally uses MIN_EMIN,
so the result would also underflow to zero for all emin > MIN_EMIN.
In case digits are left, the informal argument is as follows: Underflow can
occur only once in the last multiplication of the power stage (in the Horner
stage Underflow provably cannot occur, and if Underflow occurred twice in
the power stage, the result would underflow to zero on the second occasion).
Since there is no double rounding during Underflow, the effective work
precision is now 1 <= result->digits < prec. It can be shown by a somewhat
tedious argument that abs(result - e**x) < ulp(result, result->digits).
Therefore the correct rounding loop now uses ulp(result, result->digits)
to generate the bounds for e**x in case of Underflow.
|
| |
|
| |
|