Boost logo

Boost :

From: Jonathan Turkanis (technews_at_[hidden])
Date: 2004-12-12 15:47:54

Andras Erdei wrote:
> On Sun, 12 Dec 2004 12:35:29 -0700, "Jonathan Turkanis"
> <technews_at_[hidden]> wrote:
>> This is essentially what the docs currently state: "The rational
>> number class is designed for use in conjunction with an unlimited
>> precision integer class." It would be easy to prevent rational from
>> being instantiated with built-in integral types, but this would just
>> make the library less useful. Perhaps the disclaimer should be
>> featured more prominently.
> [disclaimer: i'm not native english]
> rational.html in boost 1.30.2 says:
> "Any of the built-in integer types provided by the C++ implementation
> are supported as values for I. User-defined types may also be used, but..."
> this gives the impression of non-builtins being the exception

I think you are right that this is misleading. The qualifications in "Design
Notes" --> "Limited-range integer types" need to be stated in the requirements
section. Still, it may be true that use of built-in intergal types is the most
common use, and I believe this is okay as long as users are aware of the issues.

> "It is therefore likely that the rational number class will in many
> cases be used with limited-precision integer types, such as the
> built-in int type."
> this one, too
> "When used with a limited precision integer type, the rational class
> suffers from many of the precision issues which cause difficulty with
> floating point types. While it is likely that precision issues will not affect
> simple uses of the rational class, users should be aware that such
> issues exist."

I think these passages are consistent with the statement that boost::rational is
"designed for use in conjunction with an unlimited precision integer class."

> imho with a built-in type rational<> has more issues than float,
> and not just precision, but also garbage instead of rounding, and
> it is likely to affect even simple uses

>> It sounds like you are describing a numeric type which could coexist
>> with boost::rational. Perhaps you should implement it and post it.
> it does not necessarily have to be separate from rational<>

Yes, I got that part ;-)

> if there is interest in using it, but no one is interested
> in implementing it, and it is not a problem that it will
> take months for me (end of semester, exams time) then yes,
> i can do it

Okay, let's see if there's interest.

> br,
> andras


Boost list run by bdawes at, gregod at, cpdaniel at, john at