|
Boost : |
From: Gabriel Dos Reis (gdr_at_[hidden])
Date: 2002-09-07 09:29:58
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.
[...]
| > 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.
-- Gaby
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk