printing float values will have one more digit. (#13276) [backport]

* printing float values will have one more digit. Fixes #13196
This commit is contained in:
Arne Döring 2020-02-07 17:10:25 +01:00 • committed by GitHub
commit b2c6db97f9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 45 additions and 41 deletions

View file

@ -1,7 +1,7 @@
discard """
output: '''108
11 -1 1936
0.4
0.5
true
truefalse'''
"""
@ -75,7 +75,7 @@ proc evaluate(n: Formula, varToVal: proc (name: string): float): float =
of fkMul: evaluate(n.left, varToVal) * evaluate(n.right, varToVal)
of fkExp: pow(evaluate(n.left, varToVal), evaluate(n.right, varToVal))
echo evaluate(Formula(kind: fkLit, value: 0.4), nil)
echo evaluate(Formula(kind: fkLit, value: 0.5), nil)
proc isPolyTerm(n: Formula): bool =
n.kind == fkMul and n.left.kind == fkLit and (let e = n.right;