Well, it works about as well as Excel does....
In following my tradition of decimal spreadsheet programs, here is this abomination. This implements an eight digit decimal floating point number. The numerics are ... sloppy, to say the least, but it shouldn't be noticeable so long as you are only using the program to manage the budget of a normal person. Not a millionaire. The math, at this time, only supports round-to-zero* (*round-to-zero is not always round-to-zero, see further notes).
Numbers are 6 byte floating point. They inefficiently store the sign in one byte. The exponent can range from -49 to 49 (so that multiplication and division can never overflow a byte). The significand (please don't call it a mantissa) is eight packed BCD digits. It is normalized, and there is no subnormal support. Zero is unsigned, and infinity and NaN are combined into a single "Err" value. As said before, it only supports round-to-zero. However, because it doesn't use a sticky digit, 1 - 1e-15
is not 0.99999999
like it ought to be. That is the only deviation from round-to-zero that I am aware of.
I do want to point out that the division algorithm in use is the one outlined for use with the Comptometer mechanical adding machine. It looked (and is) actually pretty appropriate for floating point. It's really crazy that Comptometers are half as rare as Curtas, but are a tenth the price on the antique market.
There are 100 rows (0 to 99) and twenty columns (A - T). Each cell can have 120 bytes of data in it: the string representation of the cell can be a maximum of 120 bytes. Cell calculation follows the recalculation strategy and will gladly use stale values if that cell hasn't been recomputed yet (and it doesn't do the "normal spreadsheet" thing of doing multiple passes).
The formula evaluation engine has two stacks: one for data and one for operations. The data stack is fifteen values deep, and the operation stack is thirty one values deep. If I understand the manual correctly, these stacks are larger than a late 90's budget graphing calculator.
Update: there are now 26 columns. Old save files will load funny.
Update: you now need to press x
twice to delete the current cell's contents.
WASD
and Cursor keys - Navigate the sheetz
or Home - Go to cell A0[
- Decrease the size of the current column]
- Increase the size of the current column'
or"
- Insert a label in this cell, overwriting previous contents=
or+
- Insert a formula in this cell, overwriting previous contents!
- Recalculate sheetxx
- Delete/clear the current cell's contentsxr
- Delete/clear the current row's contentsxc
- Delete/clear the current column's contentse
- Edit the current cell (if it has contents)ii
- Insert a cell at this location, pushing current cells right and deleting the right-most cell.ir
- Insert a new row at this row, pushing current rows down and deleting the bottom-most row.ic
- Insert a new column at this column, pushing current columns right and deleting the right-most column.oo
- Insert a cell at this location, pushing current cells down and deleting the bottom-most cell.or
- Insert a new row below this row, pushing current rows down and deleting the bottom-most row.oc
- Insert a new column to the right of this column, pushing current columns right and deleting the right-most column.uu
- Remove the current cell, shifting existing cells leftuo
- Remove the current cell, shifting existing cells upur
- Remove the current row, shifting existing rows upuc
- Remove the current column, shifting existing columns leftq
- Quit: you must follow aq
with ay
to really quit.,
- Toggle comma as the output decimal separatorj
- Toggle row/column-major recalculationk
- Toggle left-to-right or right-to-left recalculationl
- Toggle top-to-bottom or bottom-to-top recalculationn
- Save file (use contents of current cell as file name)m
- "Load" file (use contents of current cell as file name)ENTER
- Exit edit mode
Formulas are very basic infix notation:
5 + 2 * 3 - 7 / (3 + -5)
You can call functions using the really old notation:3 + @sum(A0; 2; 3; A2:B4)
Cells are reference-able by name (but note that anchoring$A$12
is not supported):A2
Cell ranges are only accepted by certain functions (SUM, AVERAGE, COUNT, MIN, and MAX):@sum(A0:c5)
The list of functions:
- AVERAGE
- SUM
- COUNT
- MIN
- MAX
- ROUND
- TRUNC
- ABS
The save file format is very basic: it outputs the characters needed to recreate the sheet from input. As such, the load function merges (and overwrites) the loaded file into whatever is currently loaded. It is very basic, but even that made me fight with my compiler due to my 16K (now 14K) table.