✓
Passing This code compiles and runs correctly.
Code
// std/quantity: kinetic energy — E = 0.5 * m * v^2.
// 0.5 * (2.0+-0.1 kg) * (3.0 m/s)^2 = 9 J (dims compose, uncertainty
// propagates: 9 * 0.1/2.0 = 0.45).
import std/io
import std/quantity
std/quantity:lit { 0.5 }
| exact h |> std/quantity:lit { 2.0+-0.1 kg }
| exact m |> std/quantity:lit { 3.0 m/s }
| exact v |> std/quantity:pow(a: v, n: 2)
| exact v2 |> std/quantity:mul(a: h, b: m)
| exact hm |> std/quantity:mul(a: hm, b: v2)
| exact e |> std/quantity:render(n: e): t |> std/io:print.ln("{{ t:s }}")
| mixed-cov |> std/io:print.ln("mixed-cov")
| bad x |> std/io:print.ln("{{ x:s }}")
| sym-unc |> std/io:print.ln("sym-unc")
| mixed-cov |> std/io:print.ln("mixed-cov")
| bad x |> std/io:print.ln("{{ x:s }}")
| sym-unc |> std/io:print.ln("sym-unc")
| div-zero |> std/io:print.ln("div-zero")
| sym-unc |> std/io:print.ln("sym-unc")
| bad x |> std/io:print.ln("bad v")
| bad x |> std/io:print.ln("bad m")
| bad y |> std/io:print.ln("bad h")
Actual
9e0|m^2 s^-2 kg^1 A^0 K^0 mol^0 cd^0|4.5e-1
Expected output
9e0|m^2 s^-2 kg^1 A^0 K^0 mol^0 cd^0|4.5e-1
Flows
flow ~lit click a branch to expand · @labels scroll to their anchor
lit (source: 0.5)
Test Configuration
MUST_RUN