diff options
author | Charles Harris <charlesr.harris@gmail.com> | 2008-07-20 19:24:54 +0000 |
---|---|---|
committer | Charles Harris <charlesr.harris@gmail.com> | 2008-07-20 19:24:54 +0000 |
commit | 20a3dc5b74166d985b75471f0ea55d49575445dd (patch) | |
tree | 293c61435f7146f790182d7afde5db4b89b9c166 /numpy/core/src/umathmodule.c.src | |
parent | 5808ab5ef5cc0d16c74dc14d7eefa22386f16e81 (diff) | |
download | numpy-20a3dc5b74166d985b75471f0ea55d49575445dd.tar.gz |
Fix ticket #794.
Diffstat (limited to 'numpy/core/src/umathmodule.c.src')
-rw-r--r-- | numpy/core/src/umathmodule.c.src | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/numpy/core/src/umathmodule.c.src b/numpy/core/src/umathmodule.c.src index 9096cdbf1..760d6d57e 100644 --- a/numpy/core/src/umathmodule.c.src +++ b/numpy/core/src/umathmodule.c.src @@ -1683,9 +1683,15 @@ static void #define BOOL_negative BOOL_logical_not -#define _SIGN1(x) ((x) > 0 ? 1 : ((x) < 0 ? -1 : 0)) +#define _SIGN1(x) (isnan((x)) ? NAN : ((x) > 0 ? 1 : ((x) < 0 ? -1 : 0)) ) #define _SIGN2(x) ((x) == 0 ? 0 : 1) -#define _SIGNC(x) (((x).real > 0) ? 1 : ((x).real < 0 ? -1 : ((x).imag > 0 ? 1 : ((x).imag < 0) ? -1 : 0))) +#define _SIGNC(x) (isnan((x.real)) ? NAN : \ + isnan((x.imag)) ? NAN : \ + ((x).real > 0) ? 1 : \ + ((x).real < 0 ? -1 : \ + ((x).imag > 0 ? 1 : \ + ((x).imag < 0) ? -1 : 0))) + /**begin repeat #TYPE=BYTE,SHORT,INT,LONG,LONGLONG,FLOAT,DOUBLE,LONGDOUBLE,UBYTE,USHORT,UINT,ULONG,ULONGLONG# #typ=byte,short,int,long,longlong,float,double,longdouble,ubyte,ushort,uint,ulong,ulonglong# |