From 6817d5861986084f55785842b07639f7aeaacf0a Mon Sep 17 00:00:00 2001 From: Sam Anthony Date: Sat, 4 Oct 2025 13:56:56 -0400 Subject: accept e-notation --- calc.go | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'calc.go') diff --git a/calc.go b/calc.go index 67794aa..1e0e598 100644 --- a/calc.go +++ b/calc.go @@ -61,17 +61,13 @@ func (c *Calculator) negate() { } } -// performOp performs the specified arithmetic operation. -func (c *Calculator) performOperation(operator byte) { - fn, err := parseOperator(operator) - if err != nil { - return - } +// operate performs a binary arithmetic operation on the stored values. +func (c *Calculator) operate(op Op) { lhs, rhs, err := c.operands() if err != nil { return } - c.stack.push(fn(lhs, rhs)) + c.stack.push(op(lhs, rhs)) c.buf = "" } -- cgit v1.2.3