From: David Greene (greened_at_[hidden])
Date: 2006-06-08 13:32:40
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.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk