ref: e9e65bff7f2881102adc9b48e3e47a17b6e2094d
parent: 5acf222abf7bd65e3ccfe19b30fedd361d92cd7c
author: Sigrid Solveig Haflínudóttir <sigrid@ftrv.se>
date: Thu Feb 27 20:48:35 EST 2025
cmp_lt: return false if any is nan
--- a/meson.build
+++ b/meson.build
@@ -15,6 +15,7 @@
#'-Wconversion',
#'-Wfloat-equal',
#'-Wsign-conversion',
+ '-Wpedantic',
'-Waggregate-return',
'-Werror=odr',
'-Werror=strict-aliasing',
--- a/src/operators.c
+++ b/src/operators.c
@@ -155,9 +155,12 @@
double da = conv_to_double(a, atag);
double db = conv_to_double(b, btag);
+ if(isnan(da) || isnan(db))
+ return false;
+
// casting to double will only get the wrong answer for big int64s
// that differ in low bits
- if(da < db && !isnan(da) && !isnan(db))
+ if(da < db)
return true;
if(db < da)
return false;