Boost logo

Boost :

From: Cromwell Enage (sponage_at_[hidden])
Date: 2005-05-09 14:06:23


--- Andy Little <andy_at_[hidden]>
wrote:
> disallowing negative denominator seems a little
> harsh. 1 / -2 is a valid
> mathematical expression.

Very well. I'll move this restriction to
mixed_number<>.

> FWIW some comments on rational...
>
> 1) rational should have a value_type for similarity
> with integral_c.
> ( eg plus <Numerator,Denominator>::type::value_type;
> )

So, what should value_type be when either Numerator or
Denominator are big_integral<>?

> 2) Because gcd is not a primitive operation( because
> it can be expressed solely
> in terms of others); Is there a need fo the 'impl
> and '::apply rigmarole. I
> think not(Same for abs, is_negative etc.)Why is
> this amount of implementation
> complexity necessary in gcd?.

There may be an implementation of gcd<> that is more
efficient even if it works solely on big_integral<>
numbers. Or there may not, but for now, I shouldn't
rule out anything that promises to make big_integral<>
operations less expensive.

> 3) However OTOH numerator<T> and denominator<T> need
> to be applicable to
> integral_c too(Otherwise there is no advantage over
> use of member ::denomnator)
> , but is a primitive operation; Therefore the 'impl
> rigmarole should be applied.
> denominator <int_<X> >:: type == int_<1>,
> numerator <int_<X> >:: type ==
> int_<X> or whatever. It should be possible to
> mix rational and integral
> parameters pretty easily. FWIW Ive enclosed my
> rendition of denominator
> (hopefully boostified) in this method .

I hadn't thought of this, yet. I'll do it, but I'll
only specialize for integral_c_tag and
big_integral_tag; the default implementation will look
for the corresponding member type. Same for
whole_part<>, rational_part<>, real_part<>, and
imaginary_part<>.

> Thanks for working on it though ... ;-)

Not a problem, whenever I have time. :)

                              Cromwell D. Enage

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com


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