diff options
author | Charles Harris <charlesr.harris@gmail.com> | 2013-04-01 17:32:38 -0700 |
---|---|---|
committer | Charles Harris <charlesr.harris@gmail.com> | 2013-04-01 17:32:38 -0700 |
commit | 134bcb0057007c4d821b911eb7b0df1797b054bd (patch) | |
tree | f56b1592d52080ede3a4b3d7beda41996d2a35e8 /numpy/core/src/scalarmathmodule.c.src | |
parent | a6385b3a99e508e0d2ed5a6397da29d05da27ceb (diff) | |
parent | 8b42156e8171802dda128cb23f7a0ce52c085e5a (diff) | |
download | numpy-134bcb0057007c4d821b911eb7b0df1797b054bd.tar.gz |
Merge pull request #349 from ericfode/float16pow
First attempt at BF for 2165 and added better tests for scalarmath pow function
Diffstat (limited to 'numpy/core/src/scalarmathmodule.c.src')
-rw-r--r-- | numpy/core/src/scalarmathmodule.c.src | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/numpy/core/src/scalarmathmodule.c.src b/numpy/core/src/scalarmathmodule.c.src index 57c610b9e..b87d9b405 100644 --- a/numpy/core/src/scalarmathmodule.c.src +++ b/numpy/core/src/scalarmathmodule.c.src @@ -494,16 +494,25 @@ half_ctype_remainder(npy_half a, npy_half b, npy_half *out) { /**end repeat**/ /**begin repeat - * #name = half, float, double, longdouble# - * #type = npy_half, npy_float, npy_double, npy_longdouble# + * #name = float, double, longdouble# + * #type = npy_float, npy_double, npy_longdouble# */ static npy_@name@ (*_basic_@name@_pow)(@type@ a, @type@ b); static void -@name@_ctype_power(@type@ a, @type@ b, @type@ *out) { +@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) +{ + 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 * #name = byte, ubyte, short, ushort, int, uint, @@ -1130,7 +1139,6 @@ static PyObject * int first; @type@ out = @zero@; - switch(_@name@_convert2_to_ctypes(a, &arg1, b, &arg2)) { case 0: break; @@ -1724,7 +1732,6 @@ get_functions(void) i += 3; j++; } - _basic_half_pow = funcdata[j - 1]; _basic_float_pow = funcdata[j]; _basic_double_pow = funcdata[j + 1]; _basic_longdouble_pow = funcdata[j + 2]; |