From 1f47b5e16c828759d17c4ecbfb6540df43786a0d Mon Sep 17 00:00:00 2001 From: r4 Date: Sun, 26 Dec 2021 11:59:01 +0100 Subject: [PATCH] fix float precision loss bug --- runtime.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime.c b/runtime.c index cfe6d5b..6ae7049 100644 --- a/runtime.c +++ b/runtime.c @@ -22,7 +22,7 @@ Value eval_binary(IRInstr instr, const Value *lhs, const Value *rhs) { .Int = res, }; } else if (lhs->type.kind == TypeFloat && rhs->type.kind == TypeFloat) { - float res; + double res; switch (instr) { case IRAdd: res = lhs->Float + rhs->Float; break; case IRSub: res = lhs->Float - rhs->Float; break;