diff --git a/Application/calculator.go b/Application/calculator.go index d6f4866..64c0020 100644 --- a/Application/calculator.go +++ b/Application/calculator.go @@ -121,7 +121,7 @@ func percent(display *widget.Entry) func() { valueStr := strconv.FormatFloat(valueFloat, 'f', -1, 64) lines[len(lines)-1] = valueStr //lines[len(lines)-1] = strconv.FormatInt(-value, 10) - display.Text = strings.Join(lines, "\n") + display.Text = line + "%=" + strings.Join(lines, "\n") display.Refresh() } } @@ -146,6 +146,7 @@ func equals(display *widget.Entry) func() { line := lines[len(lines)-1] line = strings.Trim(line, "+÷×") exprLine := strings.Replace(line, "÷", "/", -1) + exprLine = strings.Replace(line, "%", "/100", -1) exprLine = strings.Replace(exprLine, "×", "*", -1) expr, err := govaluate.NewEvaluableExpression(exprLine) if err != nil {