Skip to content
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

bpo-26121: Use C library implementation for math functions: #515

Merged
merged 6 commits into from
Mar 11, 2017

Conversation

serhiy-storchaka
Copy link
Member

tgamma(), lgamma(), erf() and erfc().

@mention-bot
Copy link

@serhiy-storchaka, thanks for your PR! By analyzing the history of the files in this pull request, we identified @rhettinger, @mdickinson, @tiran, @benjaminp and @tim-one to be potential reviewers.

Copy link
Member

@mdickinson mdickinson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm happy for this to be merged, provided that that merge is reverted if we encounter related issues on the buildbots.

@mdickinson
Copy link
Member

I'm happy for this to be merged,

Hmm, sorry. I take that back. After trying this branch on my own machine (OS X 10.9.5), I get the results below. The situation may have improved with more recent OS X releases, but I'd be mildly surprised if that were true. It looks as though at least using lgamma / tgamma on OS X should be avoided.

test test_math failed -- Traceback (most recent call last):
  File "/Users/mdickinson/Python/cpython/Lib/test/test_math.py", line 1287, in test_mtestfile
    '\n  '.join(failures))
AssertionError: Failures in test_mtestfile:
  lgam0000: lgamma(0.0): expected 'ValueError', got inf (not equal)
  lgam0001: lgamma(-0.0): expected 'ValueError', got -inf (not equal)
  lgam0010: lgamma(-1.0): expected 'ValueError', got inf (not equal)
  lgam0011: lgamma(-2.0): expected 'ValueError', got inf (not equal)
  lgam0012: lgamma(-1e+16): expected 'ValueError', got inf (not equal)
  lgam0013: lgamma(-1e+300): expected 'ValueError', got inf (not equal)
  lgam0014: lgamma(-1.79e+308): expected 'ValueError', got inf (not equal)
  lgam0065: lgamma(-1e-160): expected 368.4136148790473, got inf (not equal)
  lgam0066: lgamma(-1e-308): expected 709.1962086421661, got inf (not equal)
  lgam0067: lgamma(-5.6e-309): expected 709.776027137419, got inf (not equal)
  lgam0068: lgamma(-5.5e-309): expected 709.7940456429217, got inf (not equal)
  lgam0069: lgamma(-1e-309): expected 711.4987937351601, got inf (not equal)
  lgam0070: lgamma(-1e-323): expected 743.7469247408213, got inf (not equal)
  lgam0071: lgamma(-5e-324): expected 744.4400719213812, got inf (not equal)
  lgam0080: lgamma(-0.9999999999999999): expected 36.7368005696771, got 36.25168935623487 (error = 0.485 (68273333752865 ulps); permitted error = 1e-15 or 5 ulps)
  lgam0082: lgamma(-1.9999999999999998): expected 35.35050620855721, got 34.97977223968303 (error = 0.371 (52176167627355 ulps); permitted error = 1e-15 or 5 ulps)
  lgam0085: lgamma(-99.99999999999999): expected -331.85460524980596, got -331.86198661322277 (error = 0.00738 (129854318490 ulps); permitted error = 1e-15 or 5 ulps)
  lgam0106: lgamma(2.55998332785163e+305): expected 1.79769313486231e+308, got inf (not equal)
  lgam0107: lgamma(2.55998332785164e+305): expected 'OverflowError', got inf (not equal)
  lgam0108: lgamma(1.7e+308): expected 'OverflowError', got inf (not equal)
  gam0003: gamma(-inf): expected 'ValueError', got nan (not equal)
  gam0010: gamma(-1.0): expected 'ValueError', got nan (not equal)
  gam0011: gamma(-2.0): expected 'ValueError', got nan (not equal)
  gam0012: gamma(-1e+16): expected 'ValueError', got nan (not equal)
  gam0013: gamma(-1e+300): expected 'ValueError', got nan (not equal)
  gam0048: gamma(5.5e-309): expected 'OverflowError', got inf (not equal)
  gam0049: gamma(1e-309): expected 'OverflowError', got inf (not equal)
  gam0050: gamma(1e-323): expected 'OverflowError', got inf (not equal)
  gam0051: gamma(5e-324): expected 'OverflowError', got inf (not equal)
  gam0068: gamma(-5.5e-309): expected 'OverflowError', got -inf (not equal)
  gam0069: gamma(-1e-309): expected 'OverflowError', got -inf (not equal)
  gam0070: gamma(-1e-323): expected 'OverflowError', got -inf (not equal)
  gam0071: gamma(-5e-324): expected 'OverflowError', got -inf (not equal)
  gam0080: gamma(-0.9999999999999999): expected -9007199254740992.0, got -5545090608933970.0 (error = 3.46e+15 (3462108645807022 ulps); permitted error = 0 or 20 ulps)
  gam0082: gamma(-1.9999999999999998): expected 2251799813685248.5, got 1554254244048666.8 (error = 6.98e+14 (2790182278546326 ulps); permitted error = 0 or 20 ulps)
  gam0084: gamma(-100.00000000000001): expected -7.540083334883109e-145, got -7.5400833348829e-145 (error = 2.09e-158 (147 ulps); permitted error = 0 or 20 ulps)
  gam0085: gamma(-99.99999999999999): expected 7.540083334884096e-145, got 7.484632144060388e-145 (error = 5.55e-147 (38979707393848 ulps); permitted error = 0 or 20 ulps)
  gam0100: gamma(170.0): expected 4.269068009004705e+304, got 4.269068009004526e+304 (error = 1.79e+291 (368 ulps); permitted error = 0 or 20 ulps)
  gam0101: gamma(171.0): expected 7.257415615307999e+306, got 7.257415615308056e+306 (error = 5.74e+292 (46 ulps); permitted error = 0 or 20 ulps)
  gam0102: gamma(171.624): expected 1.7942117599248104e+308, got inf (not equal)
  gam0103: gamma(171.625): expected 'OverflowError', got inf (not equal)
  gam0104: gamma(172.0): expected 'OverflowError', got inf (not equal)
  gam0105: gamma(2000.0): expected 'OverflowError', got inf (not equal)
  gam0106: gamma(1.7e+308): expected 'OverflowError', got inf (not equal)
  gam0120: gamma(-100.5): expected -3.3536908198076787e-159, got -3.353690819807807e-159 (error = 1.28e-172 (254 ulps); permitted error = 0 or 20 ulps)
  gam0121: gamma(-160.5): expected -5.255546447007829e-286, got -5.255546447008043e-286 (error = 2.14e-299 (229 ulps); permitted error = 0 or 20 ulps)
  gam0122: gamma(-170.5): expected -3.3127395215386074e-308, got -3.3127395215386297e-308 (error = 2.22e-322 (45 ulps); permitted error = 0 or 20 ulps)
  gam0123: gamma(-171.5): expected 1.9316265431712e-310, got 0.0 (error = 1.93e-310 (39096556488606 ulps); permitted error = 0 or 20 ulps)
  gam0124: gamma(-176.5): expected -1.196e-321, got -0.0 (error = 1.2e-321 (242 ulps); permitted error = 0 or 20 ulps)
  gam0140: gamma(-63.349078729022985): expected 4.177797167776188e-88, got 4.177797167776471e-88 (error = 2.83e-101 (507 ulps); permitted error = 0 or 20 ulps)
  gam0141: gamma(-127.45117632943295): expected 1.183111089623681e-214, got 1.1831110896237257e-214 (error = 4.47e-228 (217 ulps); permitted error = 0 or 20 ulps)

@mdickinson
Copy link
Member

on my own machine (OS X 10.9.5)

Whoops; I forgot which laptop I was working on. The OS is OS X 10.10.5.

@mdickinson
Copy link
Member

Okay, let's give it a go and see what happens. But if the buildbots show issues with lgamma and gamma on other platforms too, I'm going to be pushing strongly to keep our own implementation on all platforms. I have confidence in the accuracy of those implementations, and I think that accuracy shouldn't be sacrificed for speed.

@mdickinson mdickinson merged commit 97553fd into python:master Mar 11, 2017
@serhiy-storchaka serhiy-storchaka deleted the bpo-26121-math-libc-funcs branch March 12, 2017 08:42
jaraco pushed a commit that referenced this pull request Dec 2, 2022
Bumps [pytest-aiohttp](https://github.com/aio-libs/pytest-aiohttp) from 0.3.0 to 1.0.3.
- [Release notes](https://github.com/aio-libs/pytest-aiohttp/releases)
- [Changelog](https://github.com/aio-libs/pytest-aiohttp/blob/master/CHANGES.rst)
- [Commits](aio-libs/pytest-aiohttp@v0.3.0...v1.0.3)

---
updated-dependencies:
- dependency-name: pytest-aiohttp
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-feature A feature request or enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants