fix float precision loss bug

This commit is contained in:
r4 2021-12-26 11:59:01 +01:00
parent dfe1ac90e8
commit 1f47b5e16c

View File

@ -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;