diff options
-rw-r--r-- | numpy/core/src/multiarray/numpyos.c | 2 | ||||
-rw-r--r-- | numpy/core/tests/test_longdouble.py | 13 |
2 files changed, 14 insertions, 1 deletions
diff --git a/numpy/core/src/multiarray/numpyos.c b/numpy/core/src/multiarray/numpyos.c index 708151c00..450ec40b6 100644 --- a/numpy/core/src/multiarray/numpyos.c +++ b/numpy/core/src/multiarray/numpyos.c @@ -619,7 +619,7 @@ NumPyOS_ascii_strtold(const char *s, char** endptr) } return result; #else - return NumPyOS_ascii_strtod_plain(s, endptr); + return NumPyOS_ascii_strtod(s, endptr); #endif } diff --git a/numpy/core/tests/test_longdouble.py b/numpy/core/tests/test_longdouble.py index 9e90e8bd1..fcc79ecbc 100644 --- a/numpy/core/tests/test_longdouble.py +++ b/numpy/core/tests/test_longdouble.py @@ -19,6 +19,7 @@ _o = 1 + np.finfo(np.longdouble).eps string_to_longdouble_inaccurate = (_o != np.longdouble(repr(_o))) del _o + def test_scalar_extraction(): """Confirm that extracting a value doesn't convert to python float""" o = 1 + np.finfo(np.longdouble).eps @@ -80,6 +81,18 @@ def test_fromstring(): err_msg="reading '%s'" % s) +@in_foreign_locale +def test_fromstring_best_effort_float(): + assert_equal(np.fromstring("1,234", dtype=float, sep=" "), + np.array([1.])) + + +@in_foreign_locale +def test_fromstring_best_effort(): + assert_equal(np.fromstring("1,234", dtype=np.longdouble, sep=" "), + np.array([1.])) + + def test_fromstring_bogus(): assert_equal(np.fromstring("1. 2. 3. flop 4.", dtype=float, sep=" "), np.array([1., 2., 3.])) |