ref: b655177494fc131a3c3e07d9b17a285785e94356
parent: b4eaf739c9583d8c241f05c86a6db32d901440c2
author: Sigrid Solveig Haflínudóttir <sigrid@ftrv.se>
date: Sun Jan 26 19:12:27 EST 2025
cmp_same_eq: don't make nans equal
--- a/operators.c
+++ b/operators.c
@@ -159,8 +159,8 @@
case T_INT64: return *(int64_t*)a == *(int64_t*)b;
case T_UINT64: return *(uint64_t*)a == *(uint64_t*)b;
case T_MPINT: return mpcmp(*(mpint**)a, *(mpint**)b) == 0;
- case T_FLOAT: return *(float*)a == *(float*)b;
- case T_DOUBLE: return *(double*)a == *(double*)b;
+ case T_FLOAT: return *(float*)a == *(float*)b && !isnan(*(float*)a);
+ case T_DOUBLE: return *(double*)a == *(double*)b && !isnan(*(double*)b);
}
return 0;
}