Repository navigation
v0.1.8
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 | bashIf 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 + 300gis5.3kg). A product or quotient combines the units, and a result with no dimension is a plain number (6m / 3cmis200). Two quantities of different dimensions are an error that says so. - Conversion.
5kg.to('g')gives5000g. Celsius differences stay Celsius (20°C - 10°Cis10°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 and5m.is 0.005, both exact numbers, andmalone is still the metre. - Uncertainty.
10.5(3)e-3kgand5kg ± 100gcarry 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,maxandmedianof 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 like12gor10minto 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 (siquant0.1.2).
Data, angles and time
- Data. The bit
band the byteBtake the SI prefixes (kBis 1000 B) and the binary ones (KiBis 1024 B). A rate needs no unit of its own (MiB.s^-1), and1Ki.is 1024.Data,DataRateandDataDensitycolumns can be shown in any of them,Data[GiB], so a drive's capacity over its platter area comes out inTib.m^-2. - Angles.
radis the base unit, withsr,lmandlxbuilt on it, and°(alsoº),′and″as units.45°30′30″is a literal, anddms()writes an angle that way.sin,cosandtantake an angle in any unit (a plain number is radians), andarcsin,arccosandarctangive back aradquantity. Seeexamples/angles.omx. - Time. A quantity of time can be added to a time, date or date-time,
17:05:00 + 10s, as aDurationcan, and converts to and from aDuration. A time of day wraps at midnight, and a date-time follows the clocks of its zone. Seeexamples/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,conjandarg, withabs,sqrt,exp,ln, the logarithms, and the inverse trigonometric and hyperbolic functions, now take aComplex. Their results come back complex where they leave the real line (arcsin(2)is1.571+1.317i).- A
Complexconverts to a real only when its imaginary part is exactly zero. The old tolerance that allowed3+1e-16ito convert is gone. - A column of complex results is typed as
Complex. Seeexamples/complex.omx.
How numbers are shown
- A
Decimal, aFloat, the parts of aComplexand aQuantityare shown to three places after the point. Anything cut is marked with·(1/3is0.333·,sqrt(2)is1.414·,arcsin(1)is1.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, andomasheet eval --exactand files give every digit. - Before that, a
Floator the part of aComplexis rounded to 15 places so that the noise of a calculation shows as nothing:cos(90°)is0·and not6.123e-17. The 15 is thefloat_placesof the display style, which can be turned off in code but has no setting in the app yet. - A
Scientificand 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-mdrenders documents from sheets with the same displays as the grid (seeexamples/showcase/for a Starship flight-plan example).- The
omasheetagent 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
dateformatsexample differs on a machine whose locale writesAMandPMwhere the example expectsa.m.andp.m.. - The clipboard changes for whole columns were tried out only by building and starting the app.