4545 *****************************************************************************
4646 */
4747
48-
4948/**begin repeat
5049 *
5150 * #TYPE = BOOL, BYTE, UBYTE, SHORT, USHORT, INT, UINT, LONG, ULONG,
@@ -60,6 +59,7 @@ NPY_INLINE static int
6059}
6160/**end repeat**/
6261
62+
6363/**begin repeat
6464 *
6565 * #TYPE = FLOAT, DOUBLE, LONGDOUBLE#
@@ -68,10 +68,17 @@ NPY_INLINE static int
6868NPY_INLINE static int
6969@TYPE @_LT (@type @ a , @type @ b )
7070{
71- return a < b ;
71+ return a < b || ( b != b && a == a ) ;
7272}
7373/**end repeat**/
7474
75+
76+ /*
77+ * For inline functions SUN recommends not using a return in the then part
78+ * of an if statement. It's a SUN compiler thing, so assign the return value
79+ * to a variable instead.
80+ */
81+
7582/**begin repeat
7683 *
7784 * #TYPE = CFLOAT, CDOUBLE, CLONGDOUBLE#
@@ -80,10 +87,26 @@ NPY_INLINE static int
8087NPY_INLINE static int
8188@TYPE @_LT (@type @ a , @type @ b )
8289{
83- return a .real < b .real || (a .real == b .real && a .imag < b .imag );
90+ int ret ;
91+
92+ if (a .real < b .real ) {
93+ ret = a .imag == a .imag || b .imag != b .imag ;
94+ }
95+ else if (a .real > b .real ) {
96+ ret = b .imag != b .imag && a .imag == a .imag ;
97+ }
98+ else if (a .real == b .real || (a .real != a .real && b .real != b .real )) {
99+ ret = a .imag < b .imag || (b .imag != b .imag && a .imag == a .imag );
100+ }
101+ else {
102+ ret = b .real != b .real ;
103+ }
104+
105+ return ret ;
84106}
85107/**end repeat**/
86108
109+
87110/* The PyObject functions are stubs for later use */
88111NPY_INLINE static int
89112PyObject_LT (PyObject * pa , PyObject * pb )
0 commit comments