|
Boost : |
From: Joerg Walter (jhr.walter_at_[hidden])
Date: 2002-09-07 10:12:12
----- Original Message -----
From: "Gabriel Dos Reis" <gdr_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Saturday, September 07, 2002 4:29 PM
Subject: Re: [boost] Formal Review for Interval Library (was:
IntervalLibrary reminder)
> jhr.walter_at_[hidden] (Joerg Walter) writes:
> | > Next, how do we do the
> | > computation? One (or maybe the two intervals) need to be converted to
a
> | > common type, but we don't have such a conversion. It's always the same
> | > problem: we can't afford to convert between interval types with
different
> | > base types.
> |
> | You've lost me. Don't you can afford it, because it's too dangerous?
>
> It isn't clear that converting to the type with greater precision is
> really a solution -- you may get surpises by mixing precisions. So if
> the user really does want to compute with the widest precision then
> he/she should just say so explicitly.
>
> | > This problem isn't really new. A lot of libraries suffer from the same
> | > limitation, beginning with the standard library (just try to do
> | > 'complex<double> = complex<double> + complex<float>').
> |
> | You're right (I had to check this ;-(. But is this a strenght of
> | std::complex and a weakness of the builtin data types?
>
> I'm not sure we should speak here of stenght or weakness since mixing
> precisions can prove to be trouble some. In that view, I can
> undersstand that a general purpose library doesn't provide mixed
> precisions; it suffices it provides the appropriate conversion functions.
Ok, but the fact remains, that such a general purpose class doesn't behave
like the builtin data types and it should, IMHO. Would you really like to
abolish type promotion?
> | > You are right, it's not a problem of the interval library. The C++
> | > Standard says that "the effect of instantiating the template complex
for
> | > any type other than float, double or long double is unspecified"
(26.2.2).
> | > Not being able to instantiate complex<interval> because the Standard
> | > decided the only interesting types are float, double and long double
is
> | > really a pity.
> |
> | Does this mean, that we need boost::complex<>?
>
> No (for that sole reason), IMHO.
The only other way I see is, that standard library vendors document how to
extend their implementations and boost supports one ore more different
extensions then.
Regards
Joerg
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk