From c161e760113f5712689e8d15fd8141b77d82d7f5 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Mon, 7 Sep 2020 19:06:07 +0200 Subject: eval: ensure that x / NaN yields NaN Signed-off-by: Jo-Philipp Wich --- eval.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'eval.c') diff --git a/eval.c b/eval.c index 745a97c..6d6f8c3 100644 --- a/eval.c +++ b/eval.c @@ -1085,6 +1085,8 @@ ut_execute_arith(struct ut_state *state, uint32_t off) case T_DIV: if (d2 == 0.0) return ut_new_double(INFINITY); + else if (isnan(d2)) + return ut_new_double(NAN); else if (!isfinite(d2)) return ut_new_double(0.0); -- cgit v1.2.3