|
@@ -1,5 +1,6 @@
|
|
|
import { IVProgParser } from "../ast/ivprogParser";
|
|
|
import * as Expressions from "../ast/expressions";
|
|
|
+import { Types } from "../typeSystem/types";
|
|
|
|
|
|
const TYPES = {
|
|
|
VARIABLE: "var",
|
|
@@ -102,7 +103,14 @@ function expressionWalker (expression) {
|
|
|
} else {
|
|
|
let value = expression.value;
|
|
|
if (expression.value.toNumber) {
|
|
|
- value = expression.value.toNumber();
|
|
|
+ if (
|
|
|
+ Types.REAL.isCompatible(expression.type) &&
|
|
|
+ expression.value.decimalPlaces() == 0
|
|
|
+ ) {
|
|
|
+ value = expression.value.toFixed(2);
|
|
|
+ } else {
|
|
|
+ value = expression.value.toNumber();
|
|
|
+ }
|
|
|
}
|
|
|
result = [
|
|
|
{
|