优化:在使用BBS命令时,避免出现0.999999这样的数值。

pull/858/MERGE
ChenX 5 years ago
parent 07f8118e8b
commit 6d03ca5a32

@ -1,5 +1,5 @@
import { equaln } from "../Geometry/GeUtils"; import { equaln } from "../Geometry/GeUtils";
import { clamp as CLAMP } from "./Utils"; import { clamp as CLAMP, FixedNotZero } from "./Utils";
let abs = Math.abs; let abs = Math.abs;
let acos = Math.acos; let acos = Math.acos;
@ -97,6 +97,6 @@ export function ParseExpr(expr: string, params?: {})
let strs = expr.match(Reg_Expr); let strs = expr.match(Reg_Expr);
if (!strs) return expr; if (!strs) return expr;
for (let str of strs) for (let str of strs)
expr = expr.replace(str, safeEval(str.slice(1, -1), params).toString()); expr = expr.replace(str, FixedNotZero(safeEval(str.slice(1, -1), params), 2));
return expr; return expr;
} }

Loading…
Cancel
Save