
max=$[-(10^100)]
min=$[10^100]
t=!singlespace $(reply$i)
t=!rawmath $t
t=!mathsubst I=i in $t
reply$i=$t
t=!translate internal = to $\
$ in $t
!distribute lines $t into t,t2
t2=!trim $t2
!if $t2!=$empty
 t=$t-($t2)
!else
 reply$i=$t = 0
!endif
s=!singlespace $(replygood$i)
s=!mathsubst I=i in $s
s=!translate internal = to $\
$ in $s
!distribute lines $s into s,s2
s2=!trim $s2
!if $s2!=$empty
 s=$s-($s2)
!endif
vars=!varlist nofn $s
n=!itemcnt $vars
!if $n<1
 Test=bad $i
 !exit
!endif
test=0
tn=0
!for N=1 to 5*$testnum
 tt=($t)/($s)
 gt=$s
 !for j=1 to $n
  vt=!random $leftrange,$rightrange
  v=!item $j of $vars
  !if $v notitemof e,E,pi,Pi,PI,Euler,EULER,euler,NaN,Inf
   tt=!mathsubst $v=($vt) in $tt
   gt=!mathsubst $v=($vt) in $gt
  !endif
 !next j
 gt=$[$gt]
 !if NaN isin $gt or Inf isin $gt
  Test=bad $i
  !exit
 !endif
 !if abs($gt)>10/$precision
  test=$[$tt]
  !advance tn
 !endif
 max=$[max($max,$test)]
 min=$[min($min,$test)]
 !if $tn>=$testnum
  !break
 !endif
!next N
!if $tn<$testnum
 Error=bad
 !exit
!endif
abs=$[max(abs($min),abs($max))]
!if $abs<1/$precision or ($max)*($min)<0
 test=100
!else
 test=$[abs($max-($min))/$abs]
!endif

!if NaN notin $test
 !if $test<1/$precision
  diareply$i=good
  !advance freegot
 !else
  !if $test<1/sqrt($precision)
   !advance precgood
   precreply$i=yes
  !endif
  diareply$i=bad
 !endif
!endif

