Rev 12533 | Blame | Compare with Previous | Last modification | View Log | RSS feed
option:symbols=" "
parleft=(
dd=$(reply$i)
c=!char 1 of $dd
!if $c=+ or $c=-
dd=!char 2 to -1 of $dd
!endif
!if $computeanswer!=yes and \
( + isin $dd or - isin $dd or * isin $dd or ^ isin dd \
or $parleft isin $dd or ( . isin $dd and / isin $dd ) )
test=NaN nocompute
!exit
!else
reply$i=!rawmath $(reply$i)
test=$[$(reply$i)]
!endif
m_reply$i=$(reply$i)
!if $wims_read_parm=nocompare
!if NaN isin $test
!exit
!endif
!exit
!endif
gcnt=!itemcnt $(replygood$i)
!if $gcnt<2
:badgood
Text=bad $i
!exit
!endif
gcnt2=$[floor($gcnt/2)]
!if NaN isin $test or Inf isin $test
!exit
!endif
diag=no
!for t=1 to $gcnt2
g1=$(replygood$i[2*$t-1])
g2=$(replygood$i[2*$t])
!distribute item $[$g1],$[$g2] into G1,G2
g1=!lower $g1
g2=!lower $g2
!if NaN isin $G1$G2
!goto badgood
!endif
!if inf notin $g1$g2 and $G1>$G2
!exchange G1,G2
!endif
!if $t=1
!if inf notin $g1$g2
replyGood$i=$[($G1+($G2))/2]
!else
replyGood$i=$g1,$g2
!endif
!endif
!if (inf isin $G1 or $G1<=$test) and (inf isin $G2 or $G2>=$test)
diag=yes
!endif
!next t
!if $[$gcnt%2]=1
replyGood$i=$(replygood$i[-1])
!endif
!if $diag=yes
diareply$i=good
!advance freegot
!else
diareply$i=bad
!endif