Why there is no boost::rational for non IntType ?

Why there is no boost::rational for non IntType ? I think there are cases where we require such type of rationals, e.g. ( 2 + 3i) / (5 + 6i). In std::complex, we don't have any such constraint on element type of the complex number. That is, though std::complex<double> is quite natural we can have the construct std::complex<int> as well. Is boost::rational<> strictly modeled on the basis of rational numbers ? Another question, is there any continued fraction library in BOOST ? With Regards, Reetesh Mukul

Reetesh Mukul a écrit :
That is, though std::complex<double> is quite natural we can have the construct std::complex<int> as well. FYI, this is not true:
The standard, 26.2/2: *The effect of instantiating the template complex for any type other than float, double or long double is unspecified.*
-- Loïc

Reetesh Mukul wrote: [snip]
Another question, is there any continued fraction library in BOOST ?
The Math Toolkit library in Boost 1.35 has support for continued fractions. Go to the Math/Special Functions docs, and then look under Internal Details and Tools. --Johan Råde

Johan Råde wrote:
Reetesh Mukul wrote:
[snip]
Another question, is there any continued fraction library in BOOST ?
The Math Toolkit library in Boost 1.35 has support for continued fractions. Go to the Math/Special Functions docs, and then look under Internal Details and Tools.
To be precise: it has support for continued fraction *evaluation* - as required by many special functions implementations - it does *not* support continued fractions as a distinct type (similar to Boost.Rational) with full arithmetic support etc. HTH, John.
participants (4)
-
Johan Råde
-
John Maddock
-
Loïc Joly
-
Reetesh Mukul