[J3] New reference BLAS NRM2 routines

Van Snyder Van.Snyder at jpl.nasa.gov
Mon Oct 8 16:20:57 EDT 2018

New IEEE-aware Fortran reference level-1 BLAS routines *NRM2 for the
2-norm of a vector are described in ACM Transactions on Mathematical
Software 44, 3 (2018).  They produce results accurate to one ULP for
vectors up to length 1.7e9 (IEEE single precision) and 9e15 (IEEE double

They use Kahan compensated summation, and therefore have a cost of about
3.5 compared to the original reference level-1 BLAS routine (Lawson et
al 1979).  They return mathematically correct IEEE flags and values for
non-finite input.  In particular, if the input contains at least one NaN
and at least one Inf, the result is +Inf and normal status.

Some processors had to be convinced not to do some oprimizations that
the standard doesn't explicitly allow in order to work correctly.  These
were inter-statement "optimizations" that produce mathematically
equivalent results, but not computationally equivalent results.  The
standard allows this only for optimizations within statements.

For the reference and LAPACK versions, which do not use compensated
summation, the article reports relative error in single precision for
vectors of length 1e5, with random values in (0,1), was about 82 ULP.


More information about the J3 mailing list