Skip to content

v0.1.8

Choose a tag to compare

@librasteve librasteve released this 13 Nov 15:54
· 70 commits to main since this release

Numbers now carry units. A cell can hold 5kg, 9.81m.s^-2 or 45°30′, and sums, products, comparisons and conversions follow the units, with an error for a mismatch. Numbers can also carry an uncertainty (10.5(3)e-3), Complex gets a full set of functions, and the way numbers are shown has changed: three places by default, with a · wherever digits are not shown.

Install or update

On Omarchy and Arch Linux, x86_64 or aarch64:

curl -fsSL https://raw.githubusercontent.com/librasteve/omasheet/main/install.sh | bash

If pacman cannot satisfy a dependency on qt6, run sudo pacman -Syu and then the line above again. Install from source to run on macOS.

SI units

A unit is written straight after the number, in SI, with no space: 5kg, 300cm, 20°C. A unit of more than one term is joined with . and takes ^ and a whole exponent, kg.m^2.s^-2. There is no / and no space.

  • Arithmetic. A sum or a comparison converts the right side to the unit of the left (5kg + 300g is 5.3kg). A product or quotient combines the units, and a result with no dimension is a plain number (6m / 3cm is 200). Two quantities of different dimensions are an error that says so.
  • Conversion. 5kg.to('g') gives 5000g. Celsius differences stay Celsius (20°C - 10°C is 10°C).
  • Prefixes and scales. All the SI prefixes work on every unit. A prefix and a . on their own is a scale: 1k. is 1000 and 5m. is 0.005, both exact numbers, and m alone is still the metre.
  • Uncertainty. 10.5(3)e-3kg and 5kg ± 100g carry their uncertainty through arithmetic.
  • Columns. A column can have a quantity type, Weight : Mass, and a unit and number format in the brackets, Weight : Mass[g; .1f]. A cell in another unit of the same kind is converted to the column's unit, a bare number is read in it, and a cell of another dimension is an error. Quantity columns are set right in the grid like any number.
  • Aggregates. sum, mean, min, max and median of a quantity column keep the unit.
  • Parquet. A quantity column is written to Parquet as a struct of value, uncertainty and unit, and its kind is kept so it opens as the same type. In CSV and JSON a quantity is written as text (5kg); an XLSX export writes text and says the unit is dropped. Importing a CSV, JSON or XLSX never turns text like 12g or 10m into a quantity.
  • The units come from siquant, a new Rust crate of SI units and prefixes (github.com/librasteve/siquant). It is taken from crates.io (siquant 0.1.2).

Data, angles and time

  • Data. The bit b and the byte B take the SI prefixes (kB is 1000 B) and the binary ones (KiB is 1024 B). A rate needs no unit of its own (MiB.s^-1), and 1Ki. is 1024. Data, DataRate and DataDensity columns can be shown in any of them, Data[GiB], so a drive's capacity over its platter area comes out in Tib.m^-2.
  • Angles. rad is the base unit, with sr, lm and lx built on it, and ° (also º), ′ and ″ as units. 45°30′30″ is a literal, and dms() writes an angle that way. sin, cos and tan take an angle in any unit (a plain number is radians), and arcsin, arccos and arctan give back a rad quantity. See examples/angles.omx.
  • Time. A quantity of time can be added to a time, date or date-time, 17:05:00 + 10s, as a Duration can, and converts to and from a Duration. A time of day wraps at midnight, and a date-time follows the clocks of its zone. See examples/durations.omx.

Approximate equality

=~= compares numbers, complex numbers and quantities within a tolerance of 1e-15 of the larger, or absolutely when either is zero: sin(pi()) =~= 0 is true where == is false. An uncertainty is ignored. == on a Float stays exact, and on a Scientific it compares within the combined uncertainty.

Uncertain numbers

A Scientific is a number with an uncertainty in brackets, 10.5(3)e-3, or written with ±. The uncertainty propagates through arithmetic and the math functions, takes the number formats, has its own entry in the type menu, and is written to Parquet as a struct (an XLSX export drops the uncertainty). ± binds tighter than any other operator. See examples/uncertainty.omx.

Complex numbers

  • re, im, conj and arg, with abs, sqrt, exp, ln, the logarithms, and the inverse trigonometric and hyperbolic functions, now take a Complex. Their results come back complex where they leave the real line (arcsin(2) is 1.571+1.317i).
  • A Complex converts to a real only when its imaginary part is exactly zero. The old tolerance that allowed 3+1e-16i to convert is gone.
  • A column of complex results is typed as Complex. See examples/complex.omx.

How numbers are shown

  • A Decimal, a Float, the parts of a Complex and a Quantity are shown to three places after the point. Anything cut is marked with · (1/3 is 0.333·, sqrt(2) is 1.414·, arcsin(1) is 1.571rad·). A number with three places or fewer is shown whole, and one below a thousandth keeps its digits. Pointing at a cell shows the number in full, and omasheet eval --exact and files give every digit.
  • Before that, a Float or the part of a Complex is rounded to 15 places so that the noise of a calculation shows as nothing: cos(90°) is 0· and not 6.123e-17. The 15 is the float_places of the display style, which can be turned off in code but has no setting in the app yet.
  • A Scientific and a quantity with an uncertainty are not cut: the uncertainty sets the digits.
  • omasheet render (Markdown and --html) sets quantity columns right, as the grid does.

In the app

  • Type and unit pickers. Set type opens a picker grouped by domain, with a live check and a master caret, and a unit picker for quantity columns that shows the base unit ticked and examples. Both have Apply and Close buttons and clear buttons, and Tab cycles between the panels.
  • Set format works like the filter box: typed with a legend panel of examples, checked as you type, and shown in red with a short reason when it is wrong.
  • F4 cycles the Set panels and shows help beside F3's.
  • Whole columns carry their type. Copying or cutting whole columns and pasting them onto whole columns brings the type, unit and format with them, including when inserted with Insert cells before/after. Paste format in the column menu pastes only the type, unit and format, with no values, and replaces Paste transposed there.
  • Copy values, selectable error messages, a draggable filter popup, a Clear filter button, filter undo at Apply, a summary that honours filters, and a cell editor that spills past the last column.

Also

  • omasheet-md renders documents from sheets with the same displays as the grid (see examples/showcase/ for a Starship flight-plan example).
  • The omasheet agent skill and a language spec of OMX are in the repository.
  • docs/ (format, expressions, OMX, app, interop), the README and the skill are up to date with all of the above.

Tests

The engine test suite passes in full. The three tests that failed in earlier builds are settled: how_much_of_the_corpus_lowers is removed, and a_comparison_uses_the_values and every_math_function_carries_its_slope were brought up to date with the comparison tolerance and the inverse trigonometric functions that give a rad quantity.

Known issues

  • The dateformats example differs on a machine whose locale writes AM and PM where the example expects a.m. and p.m..
  • The clipboard changes for whole columns were tried out only by building and starting the app.