8000 BUG: Increase accuracy of log1p for small inputs by mfkasim1 · Pull Request #22611 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content

BUG: Increase accuracy of log1p for small inputs #22611

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
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
Prev Previous commit
Next Next commit
STY: split lines that are too long for log1p complex test
  • Loading branch information
mfkasim1 committed Nov 18, 2022
commit 59ab5bd034216ff70593db57e40dd33e9306bedc
23 changes: 15 additions & 8 deletions numpy/core/tests/test_umath.py
Original file line number Diff line number Diff line change
Expand Up @@ -1816,16 +1816,23 @@ def test_log1p_complex(self):
assert_almost_equal(ncu.log1p(1e-18 + 0.1j), 0.00497517 + 0.0996687j)
assert_almost_equal(ncu.log1p(0.1 + 1e-18j), 0.0953102 + 9.09091e-19j)
assert_almost_equal(ncu.log1p(0.5 + 0j), 0.40546510810816 + 0j)
assert_almost_equal(ncu.log1p(0.0 + 0.5j), 0.11157177565710 + 0.46364760900081j)
assert_almost_equal(ncu.log1p(0.0 + 0.5j), 0.111571776 + 0.463647609j)

def test_extreme(self):
# these numbers are obtained from WarrenWeckesser and double checked with wolfram alpha
assert_almost_equal(ncu.log1p(-1 + 1e250j), 575.6462732485114 + 1.5707963267948966j)
assert_almost_equal(ncu.log1p(1e250 + 1j), 575.6462732485114 + 1e-250j)
assert_almost_equal(ncu.log1p(1e250 + 1e250j), 575.9928468387914 + 0.7853981633974483j)
assert_almost_equal(ncu.log1p(1e-250 + 1e250j), 575.6462732485114 + 1.5707963267948966j)
assert_almost_equal(ncu.log1p(1e-250 + 2e-250j), 1e-250 + 2e-250j)
assert_almost_equal(ncu.log1p(1e250 + 1e-250j), 575.6462732485114 + 0.0j)
# these numbers are obtained from WarrenWeckesser
# and double checked with wolfram alpha
assert_almost_equal(ncu.log1p(-1 + 1e250j),
575.6462732485114 + 1.5707963267948966j)
assert_almost_equal(ncu.log1p(1e250 + 1j),
575.6462732485114 + 1e-250j)
assert_almost_equal(ncu.log1p(1e250 + 1e250j),
575.9928468387914 + 0.7853981633974483j)
assert_almost_equal(ncu.log1p(1e-250 + 1e250j),
575.6462732485114 + 1.5707963267948966j)
assert_almost_equal(ncu.log1p(1e-250 + 2e-250j),
1e-250 + 2e-250j)
assert_almost_equal(ncu.log1p(1e250 + 1e-250j),
575.6462732485114 + 0.0j)

def test_special(self):
with np.errstate(invalid="ignore", divide="ignore"):
Expand Down
0