From 857c3a8ec160a618a54edd9407f77fbfc2a07678 Mon Sep 17 00:00:00 2001 From: Nathaniel Beaver Date: Thu, 10 Sep 2015 03:47:44 -0500 Subject: BUG: check lower limit of base in base_repr. --- numpy/core/numeric.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'numpy/core/numeric.py') diff --git a/numpy/core/numeric.py b/numpy/core/numeric.py index 0b728f804..756c426f7 100644 --- a/numpy/core/numeric.py +++ b/numpy/core/numeric.py @@ -2232,6 +2232,8 @@ def base_repr(number, base=2, padding=0): digits = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ' if base > len(digits): raise ValueError("Bases greater than 36 not handled in base_repr.") + elif base < 2: + raise ValueError("Bases less than 2 not handled in base_repr.") num = abs(number) res = [] -- cgit v1.2.1 From da10a1cd5eff56af9b83585bf93bbccc21fe2a1d Mon Sep 17 00:00:00 2001 From: Nathaniel Beaver Date: Mon, 1 Feb 2016 12:24:46 -0600 Subject: DOC: base_repr *can* handle negative integers. --- numpy/core/numeric.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'numpy/core/numeric.py') diff --git a/numpy/core/numeric.py b/numpy/core/numeric.py index 756c426f7..a672fdc53 100644 --- a/numpy/core/numeric.py +++ b/numpy/core/numeric.py @@ -2198,7 +2198,7 @@ def base_repr(number, base=2, padding=0): Parameters ---------- number : int - The value to convert. Only positive values are handled. + The value to convert. Positive and negative values are handled. base : int, optional Convert `number` to the `base` number system. The valid range is 2-36, the default value is 2. -- cgit v1.2.1