Boost logo

Boost :

From: Carlo Wood (carlo_at_[hidden])
Date: 2006-06-08 22:42:09


On Thu, Jun 08, 2006 at 05:36:40PM -0500, David Greene wrote:
> the library. Andy presented this example to justify kg's 0 power:
>
> mass::kg m(1); // 1 kg == 1000 g
> acceleration::m_div_s2 a(1); // 1 meter per second squared
> force::N f = m * a;
>
> The value of f should be 1000 Newtons right?
>
> Of course, the value is 1 Newton. But this has nothing at all to
> do with kg having a prefix power of 0 or 3. The calculation can

The point is,

  1 N = 1 kg * 1 m / 1 s / 1 s

The 1 comes from 10^0, hence 0 is needed.

  10^0 N = 10^0 kg * 10^0 m / 10^0 s / 10^0 s

  0 = 0 + 0 - 0 - 0

The calculation of the left-hand 0 is done with generic
templates using '+' to add up exponents. How is it logical
to make an exception here for kg?

If you'd force 'kg' to be 'g' internally, then you will
have to apply the same trick to N that is now applied to kg,
with the exception that then BOTH are internally not in S.I.
units (mN and g, instead of N and kg). That is, you'd end up
with:

  3 = 3 + 0 - 0 - 0

and thus mN. But you still want to print N.
I don't think it will get any better by using a prefix power of 3 for kg.

-- 
Carlo Wood <carlo_at_[hidden]>

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk