Boost logo

Boost :

From: George A. Heintzelman (georgeh_at_[hidden])
Date: 2001-08-30 10:52:10

> > From: Anatoli Tubman <anatoli_at_[hidden]>
> >
> >Oh come on. The question is not what is more fundamental, but what is
> >more useful. Which makes it much trickier, because usefulness is
> >relative. Meter is also a derived unit. This does not make it
> >any less useful.
> The metre is a base unit not a derived unit.

Actually I believe the meter is now defined in terms of a number of
wavelengths of a particular frequency of light, and the second in terms
of the speed of light (or maybe it's the second that is defined in
terms of a number of vibrations and the meter in terms of the speed of
light, I forget); the Coulomb is defined in terms of a quantity of
electrons. I believe the standard kilogram is the only 'base unit'
which is defined in terms of the qualities of a particular object
anymore. Does that mean we should have all the units stored in those
physical quantities? I think not.

Personally, I think storing all quantities in the same way is asking
for trouble with dynamic range. For example, capacitance is measured
for typical electronic components in units of picoFarads. If you store
it in units of Farads (which is what you get with 'whole' SI units),
you've just chopped 12 orders of magnitude off the upper range of what
you can represent with a particular floating-point number. If you're
using an underlying fixed-point type, the problem is even worse, and I
think that that should be a possible to do with a units library.
Likewise, in high-energy physics, one often works in a system of units
where h-bar = c = e = G = 1. The conversion factors between this system
and SI units can be very large.

I think a units library should allow the user to specify both the
dimensionality of units of a particular value *and* a base system to
use. The set of base systems would be extendable by the user, and would
specify the value of its base constants in terms of the SI units. Then
when operating on units with the same base system, no run-time overhead
is incurred; when operating on units with different base systems, the
compiler looks up the conversion constants and hopefully can reduce the
conversion to a single multiplication at compile time, invisible to the
user. Of course, a reasonable default for the base system to use would
be SI meters-kilograms-seconds.

George Heintzelman

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