You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Show exact fractions (5/8, 1 5/8) the same way in the terminal and the web UI #672
Follow-up to #432. Since #433, quantities are no longer rounded to a different fraction or converted to another unit: @milk{1 5/8%cup} stays 1.625 cup. What is left from that report is showing exact fractions, the way they are measured in a kitchen, and showing them the same way everywhere.
Today (upstream main)
@milk{1 5/8%cup} and @cocoa{5/8%cup} and @sugar{3/4%cup}.
Quantity
cook recipe
Web UI
5/8 cup
0.625 cup
5/8 cup
3/4 cup
0.75 cup
3/4 cup
1 5/8 cup
1.625 cup
1.625 cup
The web UI (format_number in crates/format/src/number.rs) shows halves, thirds, quarters and eighths as fractions only below 1; above 1 it falls back to a decimal on purpose (decimal_to_fraction returns None when there is a whole part).
The terminal (crates/format/src/human.rs) prints cooklang's own Display of the quantity, which is always a decimal.
Use the same formatter in every human-readable output — terminal, web UI, Markdown — so a recipe shows the same numbers everywhere.
Open question: whether this is the default or opt-in (a preference in the web UI and a flag or config entry for the CLI). Scaling makes it matter: a recipe scaled ×1.5 gives 2 7/16, which should probably stay 2.438.
Activity
feat(format): show exact fractions the same way in every output (cook…