feat: add power operation to calculator (#11) #12
Reference in New Issue
Block a user
Delete Branch "ai/issue-11"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Adds a
poweroperation to the calculator toolset, alongside add, subtract, multiply and divide.Changes
com.example.util.PowerFunction— newCalcFunctionimplementation. Folds inputs left-to-right withMath.pow, socalc(2, 5, 6)evaluates as(2^5)^6 = 1073741824.0. Returns0for empty input, matching the existingMultiplyFunction/DivideFunctionconvention.com.example.LoopTestApplication— wires up and prints the new operation.PowerFunctionTest— 5 tests: multiple values, single value, no input, negative exponent, zero exponent.Testing
mvn verifypasses: 22 tests, 0 failures, 0 errors.Closes #11