summaryrefslogtreecommitdiff
path: root/numpy/core/src
diff options
context:
space:
mode:
authorEric Fode <ericfode@gmail.com>2012-07-12 15:35:44 -0400
committerEric Fode <ericfode@gmail.com>2012-07-12 16:00:12 -0400
commita77a7cd5ed6bc12772ba33c151f40fbe73e9d212 (patch)
tree82cd226e60b7b73caecf7645498c12debdd16a5f /numpy/core/src
parent143fb1874b3ff3875a93accad3e87056a44d77d0 (diff)
downloadnumpy-a77a7cd5ed6bc12772ba33c151f40fbe73e9d212.tar.gz
First attempt at BF for 2028 and added better tests for scalarmath pow function
Diffstat (limited to 'numpy/core/src')
-rw-r--r--numpy/core/src/scalarmathmodule.c.src19
1 files changed, 13 insertions, 6 deletions
diff --git a/numpy/core/src/scalarmathmodule.c.src b/numpy/core/src/scalarmathmodule.c.src
index d9f7abc4e..8b66f7135 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);
+//called when ** is used (not performing properly)
static void
@name@_ctype_power(@type@ a, @type@ b, @type@ *out) {
- *out = _basic_@name@_pow(a, b);
+ *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 of = _basic_float_pow(af,bf);
+ *out = npy_float_to_half(of);
+}
/**begin repeat
* #name = byte, ubyte, short, ushort, int, uint,
@@ -970,7 +979,7 @@ static PyObject *
int retstatus;
int first;
@type@ out = {@zero@, @zero@};
-
+
switch(_@name@_convert2_to_ctypes(a, &arg1, b, &arg2)) {
case 0:
break;
@@ -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];