### /u/sy/beebe/src/elefunt/f/elefunt.awk, Thu May 23 09:30:22 2002
### Edit by Nelson H. F. Beebe <beebe@math.utah.edu>
### ====================================================================
### Extract results from the tall[ds]p.lst* files, reporting only
### those tests with bit loss in relative or root-mean-square error
### greater than specified limits.
###
### Usage:
###	awk -f elefunt.awk [-v MREMAX=x.yz] [-v RMSMAX=x.yz] tall*.lst*
###
### MREMAX is the maximum acceptable number of bits in the relative
### error.  RMSMAX is the maximum acceptable number of bits in the
### root-mean-square error.
### 
### [23-May-2002]
### ====================================================================

BEGIN				{
					if (MREMAX == "") MREMAX = 2.00
					if (RMSMAX == "") RMSMAX = 2.00
					MREMAX += 0 # coerce to number
					RMSMAX += 0
					LAST_FILENAME = ""
				}

FILENAME != LAST_FILENAME	{

				}

/^1TEST/			{
					Test = substr($0,2)
					REL_Line = ""
					RMS_Line = ""
					next
				}

/^ THE MAXIMUM RELATIVE ERROR/	{ REL_Line = $0; next }

/^ THE ROOT MEAN SQUARE /	{ RMS_Line = $0; next }

/^ THE ESTIMATED LOSS OF BASE/	{
					errbits = 0 + $NF
					if (RMS_Line == "")
					{
					    if (errbits > MREMAX)
						print Test "\n" "MRE bit loss = " $0 "\n"
					}
					else
					{
					    if (errbits > RMSMAX)
						print Test "\n" "RMS bit loss = " $0 "\n"
					}
				}
