This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: V3 PATCH: IRIX configuration


Jakub Jelinek <jakub@redhat.com> writes:

| 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).

That is an error.  Thanks.

| 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).

It is likely that those software emulated IEEE quad long double have
been tested for years.
For systems like IRIX which define cabsl only, it is my opinion that
it is a good idea to use cabsl when we can ensure that __complex__ and
the vendor specific complex_s are layout compatible.  
On systems where we've cabs and cabsl it is better to use the cabs
for float and double only (unless there is a cabsf) and cabsl for long
double.

-- Gaby
CodeSourcery, LLC                             http://www.codesourcery.com

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]