Skip to content

Fix powers of scientific literals and names ending in digits - #304

Draft
PawelTroka wants to merge 1 commit into
masterfrom
fix/complete-numeric-power-operands-20261030
Draft

PawelTroka wants to merge 1 commit into
masterfrom
fix/complete-numeric-power-operands-20261030

Conversation

@PawelTroka

@PawelTroka PawelTroka commented Oct 30, 2026 •

Copy link
Copy Markdown
Owner

Problem

The postfix-power translator recognizes a trailing digit sequence instead of the complete operand. Leading-dot fractions, separated digits, scientific notation, and identifiers ending in digits produce compilation errors or incorrect values.

For example, 2e-3² currently becomes 2*e - pow(3,2) (approximately −3.563) instead of 0.000004. .5², 1_000² and value2² also generate incorrect C#.

Change

Reuse the existing complete decimal-literal grammar for numeric power bases and require a boundary before the operand. Preserve unary precedence, existing implicit multiplication, grouped/symbolic powers, complex expressions, and literal shielding.

The production change is confined to one regex and its explanation in PowHandler.cs.

Validation

  • New 35-case fixture against unchanged production source: 29 failures / 6 passes.
  • Fixed complete portable Engine Release suite: 1,473/1,473 passed, zero failures/skips, on Linux x64 with SDK 10.0.402.
  • Windows-targeted Core.Tests Release cross-build: zero errors, two existing unused-field warnings.
  • Ten additional Core evaluation cases compile and cover default/full-source compilation, custom definitions, and complex powers. Native Windows execution remains for CI.
  • git diff --check passed.

Commands:

dotnet test Computator.NET.Engine.Tests/Computator.NET.Engine.Tests.csproj -c Release
dotnet build Computator.NET.Core.Tests/Computator.NET.Core.Tests.csproj -c Release -p:EnableWindowsTargeting=true

The uploaded Git tree is 487f01bada101cf684ce5ef2cb48b4f322a657c6, identical to the locally tested commit's tree.

Existing work

Reviewed all 78 open issues, the seven existing open PRs and recent merged work before selecting this fix. Merged #269 handles numeric literals in coefficient/division translation; merged #279 handles member/indexed power operands. Neither corrects this numeric-power regex. Open #294, #296, #298, #299, #300, #301 and #302 address separate charting, Mono and macOS behavior.

Independently based on master fe1aba49b5f9538355ffaaa3d1683f69a23d2d9c. No PR has been merged. Draft while native CI is pending.

Combined integration verification

Applied #304, #307, #308, #309 and #310 together in a separate local checkout; all five patches applied cleanly. The combined portable Engine suite passed 1,565/1,565 tests, with no failures or skips, and the combined Windows Desktop.Tests cross-build completed with zero errors (seven existing package/compiler warnings). Native Windows execution remains a CI gate. Each PR still targets master independently.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant