fix float precision loss bug
This commit is contained in:
parent
dfe1ac90e8
commit
1f47b5e16c
@ -22,7 +22,7 @@ Value eval_binary(IRInstr instr, const Value *lhs, const Value *rhs) {
|
|||||||
.Int = res,
|
.Int = res,
|
||||||
};
|
};
|
||||||
} else if (lhs->type.kind == TypeFloat && rhs->type.kind == TypeFloat) {
|
} else if (lhs->type.kind == TypeFloat && rhs->type.kind == TypeFloat) {
|
||||||
float res;
|
double res;
|
||||||
switch (instr) {
|
switch (instr) {
|
||||||
case IRAdd: res = lhs->Float + rhs->Float; break;
|
case IRAdd: res = lhs->Float + rhs->Float; break;
|
||||||
case IRSub: res = lhs->Float - rhs->Float; break;
|
case IRSub: res = lhs->Float - rhs->Float; break;
|
||||||
|
Loading…
Reference in New Issue
Block a user