% issue handle

master
dustoair 3 years ago
parent 0e07de46c5
commit 6cc136fcb6

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

Loading…
Cancel
Save