Boost logo

Boost :

From: Andy Little (andy_at_[hidden])
Date: 2006-06-08 03:49:41

"David Greene" <greened_at_[hidden]> wrote in message
> Andy Little wrote:
>>>>The kilogram rather than the gramme is a base unit in the SI. I think that
>>>>history has to do with the emergence of the SI system from the C.G.S system.
>>>>Presumably they decided that the gramme from the C.G.S system was too small
>>>>unit, the mystery then being why C.G.S used centimeters in the first place.
>>>>Whatever. I agree the whole thing is a logicians nightmare. I'm just the
>>>But I don't understand why the SI "interface" commands a particular
>>>pqs implementation. From the user perspective, they don't really care.
>>>But as soon as a programmer tries to extend the framework, nightmares
>> I dont think electrotechnology is an extension to the SI. IMO its a different
>> system in which bytes and time exists, but not mass, length, current etc etc.
> We're not talking about Mibibytes here. My question is, why does
> someone extending the "mass" abstract quantity (is that the correct
> term?) need to worry about prefix_offset? Why isn't "kilo" specified
> with "3" like it is everywhere else?

kilogram is an si base_unit.

In pqs base units are represented in compile time code by the
in header <boost/pqs/meta/unit.hpp>

The unit consists in two parts used for calculation, and an id whose purpose is
irrelevent here.

The two parts of the unit used in unit conversions are the exponent and the
multiplier, both represeneted as compile time constants

For coherent units the multiplier is one. The kilogram is a coherent unit so we
can also ignore that.

The exponent is the power of 10 by which the base unit is multiplied to get the

If kilograms played by the rules its exponent would be 3 , but for whatever
historical reasons its 0.

The output for named quantities with coherent units is computed at compile time
from the class template signature.
For those interested this is in:

 Without the prefix_offset, because kilograms has an exponent of 0, then its
unit output would be worked out as 'g', which is plainly wrong.

Does this help?

> AFAICT this has no impact on the user interface. The user will
> just specify pqs::mass::kg and doesn't care what the underlying
> "prefix number" is. But this change makes the framework extender's
> job much easier.

Complain to the SI people. It aint my fault guvnor!

Andy Little

Boost list run by bdawes at, gregod at, cpdaniel at, john at