Browse files

fixed some style problems

  • Loading branch information...
1 parent a77a7cd commit 61236250c3cc1153b233deb0ce83c6cebbc24c64 @ericfode ericfode committed Jul 13, 2012
Showing with 17 additions and 14 deletions.
  1. +8 −8 numpy/core/src/scalarmathmodule.c.src
  2. +9 −6 numpy/core/tests/test_scalarmath.py
View
16 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
View
15 numpy/core/tests/test_scalarmath.py
@@ -59,17 +59,20 @@ def test_large_types(self):
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):

0 comments on commit 6123625

Please sign in to comment.