From: Greg Chicares (chicares_at_[hidden])
Date: 2001-08-30 18:45:38
Anatoli Tubman wrote:
> On Thursday 30 August 2001 20:33, Ken Shaw wrote:
> > I think it should restrict the user to one set of measures or the other
> > with no mixing or conversion possible. Allowing both in the same
> > calculation will insert conversion errors because of the inherent
> > dissimularities of the 2 systems.
> As long as the conversion is explicit (and is called
> dangerous_inexact_unit_conversion<pounds_force>(kilogram) :) there's no
> If you don't provide a conversion, then there *is* a problem, because the
> user will provide one for himself -- incorrectly.
I feel that
pounds <--> newtons
slugs <--> kilograms
should both be allowed, but
pounds <--> kilograms
should not, unless perhaps with a real_ugly_cast.
But is it worth complicating the library with such a cast?
What would it look like? (I assume it would never permit
converting parsecs <--> volts.)
Are there other pairs of units that people might think are
equivalent (modulo a location-scale transform) but which
actually are not--or are these the only strange cases?
I haven't looked at the quantity library in a while, but
perhaps there's a way to specialize the error message in
Attempt to convert [e.g.] pounds (a unit of weight) to
kilograms (a unit of mass). Convert to newtons and divide
by the appropriate gravitational constant instead--G at
sea level on Earth, for example.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk