V3 PATCH: IRIX configuration

Gabriel Dos Reis gdr@codesourcery.com
Sun Oct 29 21:50:00 GMT 2000


Mark Mitchell <mark@codesourcery.com> writes:

[...]

|   - IRIX provides its own cabs, cabsf, and cabsl.  Obviously,
|     these do not take a `__complex__ float', or whatever, as 
|     arguments; they take a funny like IRIX-specific struct as
|     input.  For example:
| 
|       struct __cabsl_s { long double a,b; };
| 
|       extern long double cabsl( struct __cabsl_s );
| 
|     We get in trouble, since libmath tries to define these
|     same functions.  Since the layout of these things is exactly
|     like `__complex__ double' it should work to use the IRIX
|     versions, so I made that work.

Indeed, that should work after a suitable conversion.

|     (Also, the implementation of `abs' for libstdc++ in
|     src/complex.cc looked odd to me; it was:
| 
|       abs(const complex<FLT>& __x)
|       { return cabs(__x._M_value); }
| 
|     But, since there's only one cabs (which takes doubles), we'll end
|     up using double-precision even for `complex<float>' and
|     `complex<double>'.

Using a higher precision to compute a result, followed by a truncation
to the input precision is something generally harmeless (it is just
waste of ressource in case computing with higher precision is not
necessary nor useful).  That technique is usually used in routines
which are sentitive to noise.

| ...  In my patch, I changed this, but I'd
|     appreciate commentary from Gaby, as numerics expert, and anyone
|     else who knows for sure.
| 
|     (As a side-issue, using __complex__ in V3 is obviously non-potable
|     to compilers other than GCC, which is maybe or maybe not something
|     anyone cares about.)

I understood that v3 is primary for GCC (although some parts might be
compiler independent).  Using __complex__ make it possible to share
existing technologies already developed for C and FORTRAN and reduces
possible inconsistencies with C99.

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


More information about the Gcc-patches mailing list