
Boost : 
From: Deane Yang (deane_yang_at_[hidden])
Date: 20031014 12:58:41
David Abrahams wrote:
> Deane Yang <deane_yang_at_[hidden]> writes:
>
>
>>I did take a quick look, so I might have gotten the wrong idea. Please
>>forgive me if I did.
It would appear that I did get the wrong idea. Thanks for pointing that
out so gently. I'm sorry about that.
I promise to study your slides more carefully before I post again.
>
>
> The fractional power thing is strange, but OK. Anyway, it's
> essentially the same approach as mine. What Hugo's explanation is
> missing is any demonstration of how to compute the new Dimensions type
> which results from multiplication or division.
>
Darn, that's the crucial point. Using Hugo's approach, the resulting
type should be a typelist that contains the union of the two
input typelists, with the rational exponents equal to the sum
of the corresponding exponents in the input typelist.
I don't know if the "set" container exists for typelists yet, but
it is needed here.
>>I don't even know how to add fractions and reduce to lowest
>>terms in mpl yet. (Or maybe you don't try to reduce and you just test
>>for equality of fractions when you multiply two quantities. That sounds
>>a lot easier.)
>
>
> Well, then you probably want arbitraryprecision compiletime
> integers. That's a bit of work to implement.
>
I don't know if this helps, but, in practice, only very small exponents
will occur, so I'd be willing to live with very limited precision. But
it does need to be exact addition of small rational numbers.
(Mostly, I need, 1/2 + 1/2 = 1 and 1/2  1/2 = 0)
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk