Commit f00adb47f5

Andrew Kelley <andrew@ziglang.org>
2019-04-06 07:03:30
ir: avoid dependency on isnan
there's a simple way to check for nan that does not need this header. hryx on IRC reported that Linux Mint based on ubuntu 16.04, kernel 4.15.0, x86_64 did not have the isnan function.
1 parent 974977f
Changed files (1)
src
src/ir.cpp
@@ -17,7 +17,6 @@
 #include "util.hpp"
 
 #include <errno.h>
-#include <math.h>
 
 struct IrExecContext {
     ZigList<ConstExprValue *> mem_slot_list;
@@ -8251,9 +8250,9 @@ static bool float_is_nan(ConstExprValue *op) {
             case 16:
                 return f16_isSignalingNaN(op->data.x_f16);
             case 32:
-                return isnan(op->data.x_f32);
+                return op->data.x_f32 != op->data.x_f32;
             case 64:
-                return isnan(op->data.x_f64);
+                return op->data.x_f64 != op->data.x_f64;
             case 128:
                 return f128M_isSignalingNaN(&op->data.x_f128);
             default: