Boost logo

Boost :

From: Eric Ford (eford_at_[hidden])
Date: 2001-10-01 16:51:56


> What about assigning a different prime number to each dimension, and
> representing multiplication of units as multiplication of the
associated
> primes? This guarantees a unique number for every combination of
units.
> It also solves the decomposition problem (extracting the basic units
and
> their exponents from a composite unit), which I suspect may be a
> showstopper for your addition-of-hash-values approach.
>
> (Actually the numbers would have to be rationals rather than
integers to
> allow for negative powers, but compile-time rational arithmetic
> shouldn't be too difficult to implement. We already have a
compile-time
> GCD algorithm.)

But how do you handel rational powers? I beleive it's possible with
two of these, one for the numerator and one for the denominator, but
then you have to worry about reducing fractions. That could get
messy.

E


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