diff options
| author | Sam Anthony <sam@samanthony.xyz> | 2023-07-29 16:37:16 -0230 |
|---|---|---|
| committer | Sam Anthony <sam@samanthony.xyz> | 2023-07-29 16:37:16 -0230 |
| commit | c45883174aa26f9032f2c35867149971bf019525 (patch) | |
| tree | ca15fe9ddfea58c8e862e83f3cfa51edd4ceb92f /calc.go | |
| parent | 0f33f929104263a72ec386474658761a70cca90d (diff) | |
| download | pfc-c45883174aa26f9032f2c35867149971bf019525.zip | |
limit width of windowv1.0.1
Diffstat (limited to 'calc.go')
| -rw-r--r-- | calc.go | 11 |
1 files changed, 4 insertions, 7 deletions
@@ -1,9 +1,6 @@ package main -import ( - "strconv" - "strings" -) +import "strconv" type AngleMode bool @@ -36,7 +33,7 @@ func (c *Calculator) swap() { c.stack.push(f) } if st != nil { - c.buf = strings.TrimSpace(printNum(*st)) + c.buf = printNum(*st) } else { c.buf = "" } @@ -46,9 +43,9 @@ func (c *Calculator) swap() { // stack, if any. func (c *Calculator) negate() { if con := parseConstant(c.buf); con != nil { - c.buf = strings.TrimSpace(printNum(-*con)) + c.buf = printNum(-*con) } else if f, err := strconv.ParseFloat(c.buf, 64); err == nil { - c.buf = strings.TrimSpace(printNum(-f)) + c.buf = printNum(-f) } else if len(c.buf) == 0 && len(c.stack) > 0 { c.stack[len(c.stack)-1] = -c.stack[len(c.stack)-1] } |