Rev 17956 | Blame | Compare with Previous | Last modification | View Log | RSS feed
!!for the documentation
option:noreduction nospace symbols=" "
!if nospace iswordof $(replyoption$i)
reply$i=!nospace $(reply$i)
!endif
reply$i=!rawmath $(reply$i)
reply$i=!trim $(reply$i)
!if / isin $(reply$i) and . isin $(reply$i)
test=NaN badform
!exit
!endif
parleft=(
dd=$(reply$i)
c=!char 1 of $dd
!if $c=+ or $c=-
dd=!char 2 to -1 of $dd
!endif
!if ( + 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
!endif
!if nospace iswordof $option
reply$i=!nospace $(reply$i)
good=!nospace $(replygood$i)
!endif
test=$[$(reply$i)]
m_reply$i=$(reply$i)
!if NaN isin $test
!exit
!endif
!if $wims_read_parm=nocompare
!!tmp=!exec maxima print($(reply$i));
tmp=!exec pari $(reply$i)
!if / isin $(reply$i) and noreduction notwordof $(replyoption$i) and $(reply$i) notsametext $tmp
test=NaN badform noreduced
!endif
!exit
!endif
good=$[$(replygood$i)]
!if NaN isin $good or Inf isin $good
Test=bad $i
!exit
!endif
!! faut-il refuser l'exercice si $(replygood$i) contient à la fois des . et des /
!! faut-il accepter N/1 ?
replyGood$i=!exec pari $(replygood$i)
tmp=!exec pari [$(reply$i)==$(replyGood$i),$(reply$i)]
!distribute item $tmp into mres,reduced
!if $mres!=1
diareply$i=bad
!exit
!endif
!!comment: 0.0 was not accepted and 7.0 is accepted. Why ?
!!!if $good=0 and $(reply$i) notsametext 0
!! test=NaN badform
!! !exit
!!!endif
!if / isin $(reply$i) and noreduction notwordof $(replyoption$i) and $(reply$i) notsametext $reduced
test=NaN badform noreduced
!exit
!endif
!for name in reply,replygood
!if . isin $($name$i)
tmp=!replace internal . by , in $($name$i)
!distribute item $tmp into tmp1,tmp2
nbdec=!charcnt $tmp2
t1_$name=$[$($name$i)*10^$nbdec]
t2_$name=$[10^$nbdec]
!else
tmp=!replace internal / by , in $($name$i)
nb=!itemcnt $tmp
!if $nb=1
t1_$name=$($name$i)
t2_$name=1
!else
!distribute item $tmp into t1_$name,t2_$name
!endif
!endif
!next name
mres=$[($t1_reply)*($t2_replygood) - $(t1_replygood)*($t2_reply)]
!if $mres!=0
diareply$i=bad
!exit
!endif
diareply$i=good
!advance freegot