
Andy Little wrote:
Consider the calculation 1 km * 1 millisecond.
The external units approach
1 * km * 1 * millisecond, which expanding the constants would be
1 * 1000. * 1 * .001
In pqs the internal calculation at runtime is simply
1. * 1.
The type of the result encodes the calculation 1000 * .001 as plus<3,-3>::value in the unit of the result.
This, I think, is one of the great strengths of pqs. The prefix is encoded in the type system. Now, Andy claims that this is why prefix_offset is required. I believe I understand his argument but I'm not convinced yet. I'll have to do some thinking on that. I much prefer pqs' interface to conversion over the "external conversion constants" system. If I want to output something in a particular unit, I'll create a pqs variable with the appropriate unit and assign to it. -Dave