Skip to content

v0.5.0

Latest

Choose a tag to compare

@github-actions github-actions released this 23 Aug 14:24

Added

  • Quantity arithmetic at @pascal-app/lingo/calc. Closed calculator over
    already-parsed values — no variables, functions, or dimensional algebra.
    calc('7m*2') is 14 million (glued m at an operator boundary, with
    SCALE_ASSUMED); calc('9min x 4') is 36 min or 0.6 h;
    calc('half of 56kg+1700g') is 28.85 kg. Results format as words
    ("14 million"), grouped ("14,000,000"), scientific ("14e6"), or
    compact ("14m"). expression is two-way infix (7e6 × 2); latex is
    display-only. Inject calc into completions() and quantityField() so
    mixed fields keep range-first dashes (5-10 kg stays a range; =2+3 kg
    evaluates).
  • Issue codes AFFINE_DELTA_ASSUMED, EXPRESSION_KIND_MISMATCH,
    SCALAR_EXPECTED, DIVISION_BY_ZERO, SCALE_ASSUMED.

Changed

  • 2+3 kg is no longer a silent 2–3 kg range (CJK adjacent-range false
    positive). It fails with TRAILING_INPUT; use calc('2+3 kg') for 5 kg.
    Genuine CJK juxtaposition (七八天) is unchanged. Not an English corpus
    row; recorded as an interpretation change in D73.
  • Additive affine compounds (20°C + 5°C) still delta-convert, and now warn
    AFFINE_DELTA_ASSUMED.

Fixed

  • quantityField({ calc }) accepts division (10 kg / 2, 10kg/2) without
    treating glued fractions (5/10 kg) as arithmetic.
  • Compact/scientific/latex calc output keeps tight unit symbols (25°C,
    10%, $5) instead of dropping them.
  • calc('1e999') reports NONFINITE instead of masking it as NO_VALUE.
  • SCALAR_EXPECTED copy no longer claims 10 / 2 kg is two quantities.
  • Cross-currency arithmetic in calc() reports RATE_REQUIRED instead of
    treating every currency factor as 1, or masking the conversion throw as
    NONFINITE.
  • Percent arithmetic normalizes basis points and per-mille values through the
    percent base unit (100 bps of 50 kg is 0.5 kg, not 50 kg).
  • Same-kind affine ratios use canonical base values, so equivalent Celsius and
    Fahrenheit expressions agree and absolute zero alone is a zero divisor.
  • Unclosed groups no longer evaluate successfully, unary group spans include
    their sign, and serialized calc issue spans include their source text.
  • quantityField({ calc }) recognizes the calculator's word forms including
    over, multiplied by, bare half, spelled percent, and basis points.