Favoring SI base units in string formatting?
Closed this issue · 3 comments
A user reported a problem formatting units such as kJ / mol
— this outputs kW / kat
. This is unexpected, since mol
is an SI base units, whereas kat
is not. I would have expected that the string formatting tries to stick to SI (or other) base units, before moving on to derived units.
Obviously, both J
and W
are derived, but is there a way to prefer string outputs with the smaller number of derived units, i.e., "1 derived + 1 base" should be chosen over "2 derived"?
I will have to think about how add prioritization for things like that. I suspect there is a bit of a bias in the code towards electrical engineering units ie kW over kJ.
I made a few tweaks that will prioritize the to_string
conversion with muplication/division of a single base unit over other possible conversions. That addresses the specific class of issues raised here. There is more things to be done in a similar fashion but that will take some tinkering, and I think I want to get another release out soon.
Thanks, and a release would indeed be appreciated 👍