This is the mail archive of the
libstdc++@sources.redhat.com
mailing list for the libstdc++ project.
Re: V3 PATCH: IRIX configuration
On Mon, Oct 30, 2000 at 11:52:01AM +0100, Gabriel Dos Reis wrote:
> Mark Mitchell <mark@codesourcery.com> writes:
>
> | >>>>> "Gabriel" == Gabriel Dos Reis <gdr@codesourcery.com> writes:
> |
> | Gabriel> Using a higher precision to compute a result, followed by
> | Gabriel> a truncation to the input precision is something
> | Gabriel> generally harmeless (it is just waste of ressource in
> | Gabriel> case computing with higher precision is not necessary nor
> | Gabriel> useful). That technique is usually used in routines
> | Gabriel> which are sentitive to noise.
> |
> | But what about `__complex__ long double'? That one gets truncated
> | first, right?
>
> Hmm, I'm unsure about what you mean here.
>
> For __complex__ float and __complex__ double, the promotion to
> __complex__ long double followed by the truncation to float or double
> after calculations is safe.
But from reading complex.cc it looks like __complex__ float is promoted to
__complex__ double and __complex__ long double is truncated to __complex__
double, then the complex function is called and then it is truncated resp.
promoted back to the original file.
E.g.
template<>
FLT
abs(const complex<FLT>& __x)
{ return cabs(__x._M_value); }
is using cabs (ie. double precision), not cabsl (long double precision).
But using cabsl and the like in complex.cc is not a good idea IMHO either,
considering architectures with software emulated IEEE quad long double
(sparc64 and soon alpha, ppc and others).
Jakub