
Boost : 
From: Hugo Duncan (hugoduncan_at_[hidden])
Date: 20031024 10:09:47
Paul A. Bristow <boost_at_[hidden]> wrote:
> I note your use of rational dimensions to allow fractional (but not log
> and
> exp).
It seems that an implementation of compile time rationals is a
requirement, and is orthogonal to anything else, so maybe we
should start on this.
As far as I can tell, the main decision is on the signature of
of the rational type. The two possibilities that I see are
template<
typename IntegerType
, IntegerType Numerator
, IntegerType Denominator = 1
>
struct rational_c
or
template< typemame Numerator
, typename Denominator
>
struct rational_c
The first forces both numerator and denominator to have the same
integer type representation. It also limits the integer
representation to those that are representable as compile time
constants (ie if someone developed an arbitrary precision compile time
integer, it would not be useable.
The second allows arbitrary types for numerator and denominator. This
has the disadvantage that the arithmetic operators for rational have
to be able to deal with different types in numerator and denominator.
Maybe somebody (Dave, Aleksey?) could comment on compilation time
implications, and the general fit with MPL.
Hugo
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk