11#include < sleef.h>
22#include < sleefquad.h>
33#include < cmath>
4- #include < limits>
54
65// Quad Constants, generated with qutil
76#define QUAD_ZERO sleef_q (+0x0000000000000LL , 0x0000000000000000ULL , -16383 )
@@ -26,8 +25,7 @@ quad_positive(const Sleef_quad *op)
2625static inline Sleef_quad
2726quad_sign (const Sleef_quad *op)
2827{
29- Sleef_quad zero = Sleef_cast_from_doubleq1 (0.0 );
30- int32_t sign = Sleef_icmpq1 (*op, zero);
28+ int32_t sign = Sleef_icmpq1 (*op, QUAD_ZERO);
3129 // sign(x=NaN) = x; otherwise sign(x) in { -1.0; 0.0; +1.0 }
3230 return Sleef_iunordq1 (*op, *op) ? *op : Sleef_cast_from_int64q1 (sign);
3331}
@@ -293,11 +291,9 @@ quad_signbit(const Sleef_quad *op)
293291{
294292 // FIXME @juntyr or @SwayamInSync: replace with binary implementation
295293 // once we test big and little endian in CI
296- Sleef_quad zero = Sleef_cast_from_doubleq1 (0.0 );
297- Sleef_quad one = Sleef_cast_from_doubleq1 (1.0 );
298- Sleef_quad one_signed = Sleef_copysignq1 (one, *op);
294+ Sleef_quad one_signed = Sleef_copysignq1 (QUAD_ONE, *op);
299295 // signbit(x) = 1 iff copysign(1, x) == -1
300- return Sleef_icmpltq1 (one_signed, zero );
296+ return Sleef_icmpltq1 (one_signed, QUAD_ZERO );
301297}
302298
303299static inline npy_bool
0 commit comments