Boost logo

Boost :

From: Cromwell Enage (sponage_at_[hidden])
Date: 2005-03-28 12:52:35


--- Andy Little wrote: ---
> Why not call this one mixed_number?
>>
> IMO your fraction \ fraction_c functionality should
> be called rational \ rational_c for compatibility
> with the runtime boost::rational.

Okay. I suppose my choice of names was somewhat
pedantic, more appropriate in elementary school than
in here.

> FWIW IMO with your current 'rational, the extra
> parameters extend the range but not indefinitely and
> the extra number and especially sign parameters are
> cumbersome.

You prefer something like the following?

  rational_c<int,-11,16>
  mixed_number_c<int,-4,5,8>
  mixed_number_c<long,0,-6,7>

I guess the added readability would be worth the extra
logic required to calculate the sign.

> Surely better functionality and less namespace
> pollution could be had with a big_int parameter to
> the two param type.

You mean allowing Big Integral Constants as template
arguments? This would eliminate the need for
big_fraction/big_rational and big_mixed_number, but
not the concepts they were meant to model. Shouldn't
be too difficult to implement, but I need to cut down
the compile times of the other big_integral test
programs before testing rationals with such arguments
becomes feasible.

> However currently the docs state the integral
> constant requirement on parameters which IMO is an
> unnecessary restriction.

Once I attempt to allow template arguments beyond
Integral Constants and Big Integral Constants, I risk
duplicating the functionality already provided by
mpl::divides<>. Any good reason you'd want me to do
this? For example, what would a recursive rational
provide that dividing the fraction numerator by the
fraction denominator would not?

> For example a more generic alternative to
> abs_integral could be implemented as follows,
> which might be a useful mpl function anyway.

Come to think of it, mpl::abs<> would be a useful
metafunction indeed.

I'll work through all of this when I get the chance.
I have lots of personal matters to attend to before
then.

                              Cromwell D. Enage

                
__________________________________
Do you Yahoo!?
Yahoo! Small Business - Try our new resources site!
http://smallbusiness.yahoo.com/resources/


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