Boost logo

Boost :

From: Steven Watanabe (steven_at_[hidden])
Date: 2007-03-05 15:32:59


Brook Milligan <brook <at>> writes:

> It seems that the mcs-units library is moving along well. I have one
> question, though, about scope and whether the following should be
> within the scope of this library or within the scope of another one.
> In building probability and likelihood models, I often encounter the
> issue of transforming from either to their logarithms and vice versa.
> Code would be much simpler and less error-prone if the appropriate
> domain was defined, the natural arithmetic operators were used, and
> the conversions occurred (or could be prevented to catch errors) as
> necessary, but without necessarily requiring explicit bookkeeping to
> distinguish these quantities and their logarithms.
> This suggests a (small) set of types with appropriate conversions,
> much as in the units library. However, probabilities are of course
> unitless.
> Should this idea be developed as a separate library or does it make
> any sense to fold it into the existing units framework?

It would be better to develop a separate library.
Units supports only linear conversions. You need
multiplication to yield the same type as the operands
Units usually gives a different type. The specializations
that you would need to define to make Units do what
you want would require as much code as if you defined
the classes by hand.

> Cheers,
> Brook

In Christ,
Steven Watanabe

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