Improve prefix tracking
Currently, each Unit
holds a map<InternalUnit*, double>
to represent a product of units raised to different powers but only holds a single map<double, double>
representing prefix scaling for all of those units. This means it cannot distinguish between mm kg
and m g
. This is unimportant for numerics, but raises issues for how quantities are reported.
We could have per-InternalUnit prefix tracking rather than per-Unit by changing the first map above to something like map<InternalUnit*, std::pair<double, std::map<double, double>>>
or map<InternalUnit*, std::pair<double, Prefix*>>
. That seems overly complicated but without it, we cannot report prefixes properly. For example, if we have 10^6 * g m
, should we print that as 1 kg km
? as 1000 kg m
? as 1 Mg m
? or as 1 g Mm
?