1
1
#include < sleef.h>
2
2
#include < sleefquad.h>
3
3
#include < cmath>
4
- #include < limits>
5
4
6
5
// Quad Constants, generated with qutil
7
6
#define QUAD_ZERO sleef_q (+0x0000000000000LL , 0x0000000000000000ULL , -16383 )
@@ -26,8 +25,7 @@ quad_positive(const Sleef_quad *op)
26
25
static inline Sleef_quad
27
26
quad_sign (const Sleef_quad *op)
28
27
{
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);
31
29
// sign(x=NaN) = x; otherwise sign(x) in { -1.0; 0.0; +1.0 }
32
30
return Sleef_iunordq1 (*op, *op) ? *op : Sleef_cast_from_int64q1 (sign);
33
31
}
@@ -293,11 +291,9 @@ quad_signbit(const Sleef_quad *op)
293
291
{
294
292
// FIXME @juntyr or @SwayamInSync: replace with binary implementation
295
293
// 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);
299
295
// signbit(x) = 1 iff copysign(1, x) == -1
300
- return Sleef_icmpltq1 (one_signed, zero );
296
+ return Sleef_icmpltq1 (one_signed, QUAD_ZERO );
301
297
}
302
298
303
299
static inline npy_bool
0 commit comments