Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit7d9a473

Browse files
committed
Improve type numeric's calculations for ln(), log(), exp(), pow().
Set the "rscales" for intermediate-result calculations to ensure thatsuitable numbers of significant digits are maintained throughout. Theprevious coding hadn't thought this through in any detail, and as a resultcould deliver results with many inaccurate digits, or in the worst caseseven fail with divide-by-zero errors as a result of losing all nonzerodigits of intermediate results.In exp_var(), get rid entirely of the logic that separated the calculationinto integer and fractional parts: that was neither accurate norparticularly fast. The existing range-reduction method of dividing by 2^ncan be applied across the full input range instead of only 0..1, as long aswe are careful to set an appropriate rscale for each step.Also fix the logic in mul_var() for shortening the calculation when thecaller asks for fewer output digits than an exact calculation wouldrequire. This bug doesn't affect simple multiplications since that codepath asks for an exact result, but it does contribute to accuracy issuesin the transcendental math functions.In passing, improve performance of mul_var() a bit by forcing the shorterinput to be on the left, thus reducing the number of iterations of theouter loop and probably also reducing the number of carry-propagationsteps needed.This is arguably a bug fix, but in view of the lack of field complaints,it does not seem worth the risk of back-patching.Dean Rasheed
1 parente57646e commit7d9a473

File tree

5 files changed

+2853
-227
lines changed

5 files changed

+2853
-227
lines changed

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp