summaryrefslogtreecommitdiff
path: root/numpy/lib/polynomial.py
diff options
context:
space:
mode:
authorMatti Picus <matti.picus@gmail.com>2020-10-28 12:57:29 +0200
committerGitHub <noreply@github.com>2020-10-28 12:57:29 +0200
commitab22e0076608f4825bf9a3ca1b6a0a6a7a670d14 (patch)
tree4a709c270dcf877a1903e15c80b8b5b6c0e34797 /numpy/lib/polynomial.py
parent3cd6c57ffc80fa88a3c4c268f53d8d08d37e3fe5 (diff)
parent046a327f0bd452e53a4c65117e23d4e343fed233 (diff)
downloadnumpy-ab22e0076608f4825bf9a3ca1b6a0a6a7a670d14.tar.gz
Merge pull request #17577 from cjblocker/polymul-dtype
BUG: Respect dtype of all-zero argument to poly1d
Diffstat (limited to 'numpy/lib/polynomial.py')
-rw-r--r--numpy/lib/polynomial.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/numpy/lib/polynomial.py b/numpy/lib/polynomial.py
index 7b89eeb70..0fd9bbd79 100644
--- a/numpy/lib/polynomial.py
+++ b/numpy/lib/polynomial.py
@@ -426,7 +426,7 @@ def polyder(p, m=1):
>>> np.polyder(p, 3)
poly1d([6])
>>> np.polyder(p, 4)
- poly1d([0.])
+ poly1d([0])
"""
m = int(m)
@@ -754,11 +754,11 @@ def polyval(p, x):
>>> np.polyval([3,0,1], 5) # 3 * 5**2 + 0 * 5**1 + 1
76
>>> np.polyval([3,0,1], np.poly1d(5))
- poly1d([76.])
+ poly1d([76])
>>> np.polyval(np.poly1d([3,0,1]), 5)
76
>>> np.polyval(np.poly1d([3,0,1]), np.poly1d(5))
- poly1d([76.])
+ poly1d([76])
"""
p = NX.asarray(p)
@@ -1236,7 +1236,7 @@ class poly1d:
raise ValueError("Polynomial must be 1d only.")
c_or_r = trim_zeros(c_or_r, trim='f')
if len(c_or_r) == 0:
- c_or_r = NX.array([0.])
+ c_or_r = NX.array([0], dtype=c_or_r.dtype)
self._coeffs = c_or_r
if variable is None:
variable = 'x'