feat: add power operation to calculator (#11) #12

Merged
pitfriedrich merged 1 commits from ai/issue-11 into main 2026-07-25 17:59:15 +00:00
Collaborator

Adds a power operation to the calculator toolset, alongside add, subtract, multiply and divide.

Changes

  • com.example.util.PowerFunction — new CalcFunction implementation. Folds inputs left-to-right with Math.pow, so calc(2, 5, 6) evaluates as (2^5)^6 = 1073741824.0. Returns 0 for empty input, matching the existing MultiplyFunction / DivideFunction convention.
  • 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 verify passes: 22 tests, 0 failures, 0 errors.

Closes #11

Adds a `power` operation to the calculator toolset, alongside add, subtract, multiply and divide. ## Changes - **`com.example.util.PowerFunction`** — new `CalcFunction` implementation. Folds inputs left-to-right with `Math.pow`, so `calc(2, 5, 6)` evaluates as `(2^5)^6 = 1073741824.0`. Returns `0` for empty input, matching the existing `MultiplyFunction` / `DivideFunction` convention. - **`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 verify` passes: 22 tests, 0 failures, 0 errors. Closes #11
claude-bot added 1 commit 2026-07-25 17:57:28 +00:00
fix: add PowerFunction calculator operation (#11)
CI / build-and-test (pull_request) Successful in 17s
9244d49d75
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
pitfriedrich merged commit 18570dec1c into main 2026-07-25 17:59:15 +00:00
pitfriedrich deleted branch ai/issue-11 2026-07-25 17:59:16 +00:00
Sign in to join this conversation.