跳到正文
DEV Community· Calc·· 6 天前AI 評分39

Calc 為何應在網上計算器顯示公式

Show your working: why an online calculator should print its formula

AI 導讀

Calc 在每項結果下方顯示代入數值的公式,並列出計算假設,讓用戶自行核對結果。公式會以不調用網站程式碼的獨立計算方式對照測試案例;計算在瀏覽器內執行,計算收據連結則會把數值寫入網址,開啟連結時相關數值會進入伺服器日誌。

正文

Most online calculators give you one number and nothing else. You type the area of a room and get "53 tiles". If you want to know where 53 came from, you are on your own.

We built Calc around the opposite idea: the result is only half of the answer. The other half is the working.

The formula with your numbers in it

Under every result, the page prints the formula with your values already substituted. For tiles it looks like this:

12 m² × 1.10 ÷ 0.25 m² = 52.8, round up to the next whole tile.

That one line answers the questions people actually ask. Where did the 10% go? Why 53 and not 52? Is the tile area right? Anyone can check it with a phone calculator.

Assumptions as a list, not a footnote

A calculation is only as good as its assumptions. Calc shows them as a list next to the result: the waste margin, the rounding rule, what the calculator does not account for. If a number depends on a rate or a standard, the constant has a source and the date it was checked. If we cannot back a number with a source, the field stays empty and asks for your own value instead of inventing a default.

"I don't know this value"

The hardest part of a calculator is often not the maths but the input. Next to fields where a number is hard to know, there is a card that tells you where to find it: the device spec sheet, your contract, a label, or another calculator.

Nothing leaves the browser while you calculate

The calculation runs in the browser. The only exception is the "calculation receipt" link: it writes the values into the address so you can send the whole scenario to a colleague or come back to it later. Because the values are in the address, the page says plainly that they end up in the server log when someone opens the link.

Checked outside the code

Each formula is checked against test cases by a separate calculation that does not call the site's code. If the two disagree, the calculator is wrong, not the test.

That is the whole philosophy: no ads inside the result, no "AI estimates" where arithmetic will do, and a formula you can redo by hand. Calc has calculators for energy and backup power, money, small business and e-commerce, home renovation, cars, shipping and dates. They are available in Ukrainian, and most of them also in English, Polish, German and French:

https://calc.uk.app/en/

來源:DEV Community · dev.to