erg/examples/use_unit.er
Shunsuke Shibayama ff53af0cb6 feat: add RMul, RDiv
* `And` has the default type index
* impl `Dimension` traits
2024-09-20 20:36:55 +09:00

17 lines
233 B
Python

{m; s; kg; Kg} = import "unit"
print! kg + kg
j = kg*m*m/(s*s)
v = j/kg*s/m
print! m/s + v
Joule = Dimension(Int, 1, 2, -2, 0, 0, 0, 0)
j: Joule
f _: Kg = None
f kg
f kg/m*m
w = 2.0kg
assert w >= 1.0kg
assert int(w.value()) == 2