     // - isnan() and min() are defined in cupy/complex.cuh
     if (isnan(a)) {return a;}
     else if (isnan(b)) {return b;}
-    else {return min(a, b);}
+    else {return a < b ? a : b;}
+    //complex<float> ans;
+    //if (isnan(a)) {ans = a;}
+    //else if (isnan(b)) {ans = b;}
+    //else {ans = (a < b ? a : b);}
+    //printf("I got %f + I %f\n", ans.real(), ans.imag());
+    //return ans;
 }
 
 // specialization for complex<double> for handling NaNs

#include <cub/device/device_spmv.cuh>
#include <cub/device/device_scan.cuh>
#include <cub/device/device_histogram.cuh>
using namespace cub;
#else
#include <hipcub/device/device_reduce.hpp>
#include <hipcub/device/device_segmented_reduce.hpp>
//#include <hipcub/device/device_spmv.hpp>  // doesn't exist
#include <hipcub/device/device_scan.hpp>
#include <hipcub/device/device_histogram.hpp>
using namespace hipcub;
#endif


#ifndef CUPY_USE_HIP
/* ------------------------------------ Minimum boilerplate to support complex numbers ------------------------------------ */
// - This works only because all data fields in the *Traits struct are not
//   used in <cub/device/device_reduce.cuh>.
// - The Max() and Lowest() below are chosen to comply with NumPy's lexical
//   ordering; note that std::numeric_limits<T> does not support complex
//   numbers as in general the comparison is ill defined.
// - DO NOT USE THIS STUB for supporting CUB sorting!!!!!!
template <>
struct FpLimits<complex<float>>
{

    // NumPy behavior: NaN is always chosen!
    if (half_isnan(a)) {return a;}
    else if (half_isnan(b)) {return b;}
    else { return half_less(a, b) ? b : a; }
}
#endif

