GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — BUG: Fix np.quantile([Fraction(2,1)], 0.5) (#24711) · charris/numpy@fee88ab

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • numpy/lib
    • function_base.py
    • tests
      • test_function_base.py
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎numpy/lib/function_base.py‎

Copy file name to clipboardExpand all lines: numpy/lib/function_base.py
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4655,7 +4655,8 @@ def _lerp(a, b, t, out=None):
46554655
diff_b_a = subtract(b, a)
46564656
# asanyarray is a stop-gap until gh-13105
46574657
lerp_interpolation = asanyarray(add(a, diff_b_a * t, out=out))
4658-
subtract(b, diff_b_a * (1 - t), out=lerp_interpolation, where=t >= 0.5)
4658+
subtract(b, diff_b_a * (1 - t), out=lerp_interpolation, where=t >= 0.5,
4659+
casting='unsafe', dtype=type(lerp_interpolation.dtype))
46594660
if lerp_interpolation.ndim == 0 and out is None:
46604661
lerp_interpolation = lerp_interpolation[()] # unpack 0d arrays
46614662
return lerp_interpolation
Collapse file

‎numpy/lib/tests/test_function_base.py‎

Copy file name to clipboardExpand all lines: numpy/lib/tests/test_function_base.py
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3606,6 +3606,10 @@ def test_fraction(self):
36063606
assert_equal(q, Fraction(7, 2))
36073607
assert_equal(type(q), Fraction)
36083608

3609+
q = np.quantile(x, .5)
3610+
assert_equal(q, 1.75)
3611+
assert_equal(type(q), np.float64)
3612+
36093613
q = np.quantile(x, Fraction(1, 2))
36103614
assert_equal(q, Fraction(7, 4))
36113615
assert_equal(type(q), Fraction)

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.