summaryrefslogtreecommitdiffhomepage
path: root/eval.c
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2020-09-07 19:27:57 +0200
committerJo-Philipp Wich <jo@mein.io>2020-09-07 19:27:57 +0200
commitd7a4f8d3b7d0ebab6a1b6bef8f342e100ea32f1d (patch)
tree57665831d8e623355a11e69182e23fb9ef44ba7a /eval.c
parentc161e760113f5712689e8d15fd8141b77d82d7f5 (diff)
eval: ensure that dividing Infinity by Infinity yields NaN
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'eval.c')
-rw-r--r--eval.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/eval.c b/eval.c
index 6d6f8c3..4bcc2b2 100644
--- a/eval.c
+++ b/eval.c
@@ -1088,7 +1088,7 @@ ut_execute_arith(struct ut_state *state, uint32_t off)
else if (isnan(d2))
return ut_new_double(NAN);
else if (!isfinite(d2))
- return ut_new_double(0.0);
+ return ut_new_double(isfinite(d1) ? 0.0 : NAN);
return ut_new_double(d1 / d2);