rea.run

← Lab · 中文

Lab · native contrast

Rebuild Calculator’s % button — try both rules

Why does 200 + 10% become 220, while 200 × 10% becomes 20? The percent key is operator-dependent. Microsoft publishes Calculator sources, so you can arbitrate REA findings against named symbols. This page hosts a small dual-rule trial for operators on rea.run.

With +
Take 10% of the first number.
10% of 200 = 20 → 200 + 20 = 220
With ×
Turn 10% into 0.1.
200 × 0.1 = 20
200 + 10

Press % to see what happens to 10.

Interactive illustration of the operator-dependent percent rule (aligned with Microsoft Calculator’s public IDC_PERCENT branch). Not a clone of the Windows Calculator app.

Readable rule (teaching summary)

if (operation == multiply || operation == divide) {
  percent = current / 100;
} else {
  percent = current * previous / 100;
}

For previous = 200, current = 10: add path yields 20 then 220; multiply path yields 0.1 then 20.

Open-source arbitration

ItemValue / link
Public tree microsoft/calculator (MIT)
Handler (pinned commit) scifunc.cpp · IDC_PERCENT
Unit tests (pinned) CalculatorManagerTest.cpp
Command IDs IDC_MUL 92 (0x5c), IDC_DIV 91 (0x5b), IDC_PERCENT 118 (0x76); constant 0x64 = 100
case IDC_PERCENT:
{
  // multiply/divide → X [op] (Y%)
  // otherwise → X [op] (X * Y%)
  if (m_nOpCode == IDC_MUL || m_nOpCode == IDC_DIV)
    result = rat / 100;
  else
    result = rat * (m_lastVal / 100);
  break;
}

Verifiable trial matrix

ExpressionExpected %Expected resultCheck on this page
200 + 10%20220Select +, press %, press =
200 × 10%0.120Select ×, press %, press =

Operator steps

  1. Read the short showcase summary: /showcase/windows-calculator-percent/.
  2. Open the pinned scifunc.cpp and tests above; name the branch before trusting a screenshot.
  3. If you inspect an installed Calculator binary with REA, keep Evidence + public source side by side.
  4. Rebuild only teaching demos you control — not advice to tamper with OS components you are not authorized to modify.
Use REA to inspect Windows Calculator’s % button.
Recover the rules after + and ×, then build a small calculator that uses both.

Teaching disclosures

  • This widget is an interactive illustration of the inspected percentage rule — not the Windows Calculator UI.
  • Prefer Microsoft’s public MIT tree as the arbitration layer when claims conflict.
  • Authorized / educational / interoperability study only. See /compliance/ and /faq/legal-boundary/.

Related

ResourceLink
Lab hub/lab/
Dino speed lab/lab/dino-speed/
Showcase summary/showcase/windows-calculator-percent/
DX-Ball Evidence/showcase/dx-ball/
Chinese twin/zh/lab/calculator-percent/