Skip to content

Commit 4fb0032

Browse files
committed
-0 == 0
1 parent c861465 commit 4fb0032

File tree

1 file changed

+2
-8
lines changed
  • quaddtype/numpy_quaddtype/src

1 file changed

+2
-8
lines changed

quaddtype/numpy_quaddtype/src/ops.hpp

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1247,13 +1247,8 @@ quad_is_nonzero(const Sleef_quad *a)
12471247
{
12481248
// A value is falsy if it's exactly zero (positive or negative)
12491249
// NaN and inf are truthy
1250-
// Check both +0.0 and -0.0 since they may not compare equal
1251-
Sleef_quad neg_zero = Sleef_negq1_purec(QUAD_ZERO);
1252-
1253-
npy_bool is_pos_zero = Sleef_icmpeqq1_purec(*a, QUAD_ZERO);
1254-
npy_bool is_neg_zero = Sleef_icmpeqq1_purec(*a, neg_zero);
1255-
1256-
return !(is_pos_zero || is_neg_zero);
1250+
npy_bool is_zero = Sleef_icmpeqq1_purec(*a, QUAD_ZERO);
1251+
return !is_zero;
12571252
}
12581253

12591254
// Helper function to check if a long double value is non-zero (truthy)
@@ -1262,7 +1257,6 @@ ld_is_nonzero(const long double *a)
12621257
{
12631258
// A value is falsy if it's exactly zero (positive or negative)
12641259
// NaN and inf are truthy
1265-
// In C, 0.0L == -0.0L, so we only need one comparison
12661260
return *a != 0.0L;
12671261
}
12681262

0 commit comments

Comments
 (0)