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.
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
| Item | Value / 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
| Expression | Expected % | Expected result | Check on this page |
|---|---|---|---|
| 200 + 10% | 20 | 220 | Select +, press %, press = |
| 200 × 10% | 0.1 | 20 | Select ×, press %, press = |
Operator steps
- Read the short showcase summary: /showcase/windows-calculator-percent/.
- Open the pinned
scifunc.cppand tests above; name the branch before trusting a screenshot. - If you inspect an installed Calculator binary with REA, keep Evidence + public source side by side.
- 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
| Resource | Link |
|---|---|
| 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/ |