cat / 012
clone

a spreadsheet for the terminal: lotus 1-2-3 looks, google sheets keys and formulas, one go binary

Move decimal arithmetic and demo notes into the docs

Dami committed dcb7447
commit
dcb7447a48c2b64bff20f723184671aacb120cf0
parent
80d71a0360e8c126fef16403a6d59dfc612adbae
author
Dami <dami.etoile@gmail.com>
2 files changed, +34 -0
Mdocs/formulas.md23+++++++++++++++++++++++
Mdocs/testing.md11+++++++++++
M docs/formulas.md +23 -0
@@ -70,6 +70,29 @@ active cell's error and where it came from, e.g.
7070 `#DIV/0! From B3: division by zero in B5/0`, or names the chain of a7171 circular reference.7272 73+## Decimal arithmetic74+75+Like Sheets and Excel, 012 computes in binary floating point, so76+`=0.1+0.2=0.3` is FALSE and `=INT($4.35*100)` is 434. File > Settings >77+Decimal arithmetic (or search the palette for "decimal") switches the file to78+decimal math for money. The status line then says `decimal`, the menu shows a79+check mark, and the setting is saved with the file and can be undone.80+81+| Computed in decimal | Stays binary |82+|---|---|83+| `+ - * /` and postfix `%`; `SUM`, `AVERAGE`; `ROUND`, `ROUNDUP`, `ROUNDDOWN`, `TRUNC` | `^`, `SQRT`, `PRODUCT`, `SUMIF`, `SUMPRODUCT`, statistics, finance, dates and everything else |84+85+Values are still stored as doubles. Each decimal step reads its inputs as the86+shortest decimal that round-trips (what the cell shows), computes exactly87+(division to 34 significant digits) with88+[apd](https://github.com/cockroachdb/apd), and keeps the double nearest the89+result, so comparisons, lookups and formats see `0.3` rather than90+`0.30000000000000004`. Division still rounds: `=1/3*3` is 0.9999999999999999,91+as in any decimal system. Displayed numbers are already rounded to 1592+significant digits, so the setting matters for comparisons, `INT`/`MOD`-style93+truncation and residues such as `=1.1-1-0.1`. Older builds ignore the setting94+and compute in binary.95+7396 ## Functions7497 7598 See [functions.md](functions.md) for all of them, generated from the engine.
M docs/testing.md +11 -0