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]
Other format: [Raw text]

Re: [Patch,Fortran] PR 33197 Add NORM2 and PARITY


Tobias Schlüter wrote:

On 2010-08-26 15:39, Tobias Burnus wrote:

For norm2 (L2 norm), one essentially does:
tmp = max(array) ! = L_infinity norm
norm2 = tmp * sqrt( (array/tmp)**2)
to avoid an overflow.

Just a random idea: the maximum precision that such a single pass algorithm can achieve is probably obtained by using and modifying the binary exponent instead of multiplying with a scale factor as this renders the scale transformations exact.

That's what people told me to do for quick complex divide in the '90s - however, at that time there were multiple supported floating point formats, so it was not *that* simple.


If IEEE-754 format is the only one supported now, that might be doable.

Cheers,

--
Toon Moene - e-mail: toon@moene.org - phone: +31 346 214290
Saturnushof 14, 3738 XG  Maartensdijk, The Netherlands
At home: http://moene.org/~toon/; weather: http://moene.org/~hirlam/
Progress of GNU Fortran: http://gcc.gnu.org/gcc-4.5/changes.html#Fortran


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