printfn / fend

Arbitrary-precision unit-aware calculator
https://printfn.github.io/fend
MIT License
587 stars 50 forks source link

Weird issue with amp, volt, kwh #291

Open mattfbacon opened 2 months ago

mattfbacon commented 2 months ago
> w = 1 amp * 1 volt
1 watt
> c = 1 kwh
1 kWh
> (w * 1 hour) / c
1 amp volt hour / kWh
> (w * 1 hour) / c to unitless
0.001

What is going on here? I expected to get 0.001 automatically, without needing to unitless, because they are both in the same quantity.

mattfbacon commented 2 months ago

It looks like ampere is considered as a fundamental dimension in one but not the other.

> @debug (1 amp * 1 volt * 1 hour)
1 amp (amps, = 1 ampere) * volt (volts, = 1000/1000 ampere^-1 kilogram meter^2 second^-3) * hour (hours, = 3600 second) (base 10, auto, simplifiable)
> @debug (1 amp * 1 volt * 1 hour) to Wh
3600000000/3600000000 Wh (= 3600000/1000 kilogram meter^2 second^-2) (base 10, auto, not simplifiable)