diff options
author | Eric Fode <ericfode@gmail.com> | 2012-07-13 13:58:13 -0400 |
---|---|---|
committer | Eric Fode <ericfode@gmail.com> | 2012-07-13 13:58:13 -0400 |
commit | 61236250c3cc1153b233deb0ce83c6cebbc24c64 (patch) | |
tree | 355b642e919a2f899844979d6130463cc652c8c3 /numpy/core | |
parent | a77a7cd5ed6bc12772ba33c151f40fbe73e9d212 (diff) | |
download | numpy-61236250c3cc1153b233deb0ce83c6cebbc24c64.tar.gz |
fixed some style problems
Diffstat (limited to 'numpy/core')
-rw-r--r-- | numpy/core/src/scalarmathmodule.c.src | 16 | ||||
-rw-r--r-- | numpy/core/tests/test_scalarmath.py | 15 |
2 files changed, 17 insertions, 14 deletions
diff --git a/numpy/core/src/scalarmathmodule.c.src b/numpy/core/src/scalarmathmodule.c.src index 8b66f7135..39ea874c7 100644 --- a/numpy/core/src/scalarmathmodule.c.src +++ b/numpy/core/src/scalarmathmodule.c.src @@ -499,19 +499,19 @@ half_ctype_remainder(npy_half a, npy_half b, npy_half *out) { */ static npy_@name@ (*_basic_@name@_pow)(@type@ a, @type@ b); -//called when ** is used (not performing properly) static void -@name@_ctype_power(@type@ a, @type@ b, @type@ *out) { - *out = _basic_@name@_pow(a, b); +@name@_ctype_power(@type@ a, @type@ b, @type@ *out) +{ + *out = _basic_@name@_pow(a, b); } /**end repeat**/ static void -half_ctype_power(npy_half a,npy_half b, npy_half *out) +half_ctype_power(npy_half a, npy_half b, npy_half *out) { - const npy_float af = npy_half_to_float(a); - const npy_float bf = npy_half_to_float(b); - const npy_float of = _basic_float_pow(af,bf); - *out = npy_float_to_half(of); + const npy_float af = npy_half_to_float(a); + const npy_float bf = npy_half_to_float(b); + const npy_float outf = _basic_float_pow(af,bf); + *out = npy_float_to_half(outf); } /**begin repeat diff --git a/numpy/core/tests/test_scalarmath.py b/numpy/core/tests/test_scalarmath.py index 3f25d008f..74bdbcce0 100644 --- a/numpy/core/tests/test_scalarmath.py +++ b/numpy/core/tests/test_scalarmath.py @@ -59,17 +59,20 @@ class TestPower(TestCase): else: assert_almost_equal(b, 6765201, err_msg=msg) def test_mixed_types(self): - typelist = [np.int8,np.int16,np.float16,np.float32,np.float64,np.int8,np.int16,np.int32,np.int64] + typelist = [np.int8,np.int16,np.float16, + np.float32,np.float64,np.int8, + np.int16,np.int32,np.int64] for t1 in typelist: for t2 in typelist: a = t1(3) b = t2(2) - o = a**b - msg = "error with %r and %r: got %r, expected %r" % (t1,t2,o,9) - if np.issubdtype(np.dtype(o),np.integer): - assert_(o == 9,msg) + result = a**b + msg = ("error with %r and %r:" + "got %r, expected %r") % (t1, t2, result, 9) + if np.issubdtype(np.dtype(result), np.integer): + assert_(result == 9, msg) else: - assert_almost_equal(o,9,err_msg=msg) + assert_almost_equal(result, 9, err_msg=msg) class TestComplexDivision(TestCase): def test_zero_division(self): |