sharkdp / insect

High precision scientific calculator with support for physical units
https://numbat.dev/
MIT License
3.17k stars 126 forks source link

mile/gallon and gallon/mile are unexpectedly simplified #343

Closed triallax closed 1 year ago

triallax commented 2 years ago
>>> mile/gal

  mi / gal

   = 10326.3 gal^(-0.6666666666666667)

>>> gal/mile

  gal / mi

   = 9.08169e-13 mi²

Both of these results are technically correct, given that a gallon has a base representation of m3 and the mile a base representation of m, but I still doubt anybody thinks such a simplification makes one bit of sense.

sharkdp commented 2 years ago

Oh, the first one is horrible :smile:

The other one is not very useful either, I agree. The first case could certainly be fixed. For the second one, I'm not so sure. I think we'd want something like m^3/m to be simplified to m^2. So where would be the boundary?

By the way, for the second one (gal/mil is an area), there is a really neat interpretation: Imagine instead of a tank in your car, you had a gas pipeline running next to the road and your car would "scoop up" gas as it's driving along. Then the cross-section area of that pipeline would have to be equal to the "mileage" of the car.

https://what-if.xkcd.com/11/ image

triallax commented 2 years ago

Oh, the first one is horrible 😄

Haha, absolutely.

The other one is not very useful either, I agree. The first case could certainly be fixed. For the second one, I'm not so sure. I think we'd want something like m^3/m to be simplified to m^2. So where would be the boundary?

Hmm, I'm not sure. I'm okay with leaving it as-is if it's not trivial to fix, since we can still convert to the desired unit using -> gal/mile.

By the way, for the second one (gal/mil is an area), there is a really neat interpretation: Imagine instead of a tank in your car, you had a gas pipeline running next to the road and your car would "scoop up" gas as it's driving along. Then the cross-section area of that pipeline would have to be equal to the "mileage" of the car.

I think I understand what that means, but it's still a little mind-warping. It's really interesting though.

sharkdp commented 1 year ago

That first case is now treated better in Numbat: https://numbat.dev/?q=mile%2Fgal%0A