Skip to content

Commit d2e8b41

Browse files
committed
Fix complex init in scalarmath
1 parent 5f4ea8a commit d2e8b41

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

numpy/core/src/umath/scalarmath.c.src

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1625,13 +1625,31 @@ static PyObject *
16251625
* Byte, UByte, Short, UShort, Int, UInt,
16261626
* Long, ULong, LongLong, ULongLong#
16271627
*
1628+
* #ONAME = (BYTE, UBYTE, SHORT, USHORT, INT, UINT,
1629+
* LONG, ULONG, LONGLONG, ULONGLONG,
1630+
* HALF, FLOAT, DOUBLE, LONGDOUBLE,
1631+
* CFLOAT, CDOUBLE, CLONGDOUBLE)*2,
1632+
* BYTE, UBYTE, SHORT, USHORT, INT, UINT,
1633+
* LONG, ULONG, LONGLONG, ULONGLONG,
1634+
* HALF, FLOAT, DOUBLE, LONGDOUBLE,
1635+
* FLOAT, DOUBLE, LONGDOUBLE,
1636+
*
1637+
* BYTE, UBYTE, SHORT, USHORT, INT, UINT,
1638+
* LONG, ULONG, LONGLONG, ULONGLONG#
1639+
*
1640+
* #IS_COMPLEX = 0*14, 1*3, 0*14, 1*3, 0*27#
1641+
*
16281642
* #oper = negative*17, positive*17, absolute*17, invert*10#
16291643
*/
16301644
static PyObject *
16311645
@name@_@oper@(PyObject *a)
16321646
{
16331647
@type@ val;
1648+
#if @IS_COMPLEX@ == 1
1649+
@otype@ out = NPY_@ONAME@_INIT(0.0, 0.0);
1650+
#else
16341651
@otype@ out;
1652+
#endif
16351653
PyObject *ret;
16361654

16371655

0 commit comments

Comments
 (0)