Subversion Repositories wimsdev

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
20 reyssat 1
# Standardized inequality checker, sensible to m_environ.
2
# For RR, there is a danger of rounding errors rending false comparisons!
3
# Input are lines, "$left,$sign,$right".
4
# Output are lines, in $out. `true' if true, `bad' if non-checkable.
5
 
6
I__=!nonempty lines $wims_read_parm
7
n__=!linecnt $I__
8
!reset out,p__
9
!distribute item <,=,>,! into lt,eq,gt,nt
10
!distribute item integerp,ratnump,constantp into p_ZZ,p_QQ,p_RR
11
ch__=$(p_$m_environ)
12
!for i__=1 to $n__
13
 l__=!line $i__ of $I__
14
 !distribute items $l__ into L__,S__,R__
15
 L__=$maximasimp($L__)
16
 R__=$maximasimp($R__)
17
 !if $S__ isitemof $lt,$gt,$lt$eq,$gt$eq,$eq,$nt$eq
18
  !if $m_environ notwordof ZZ QQ RR
19
   p__=!append line "bad"; to $p__
20
  !else
21
   p__=!append line if $ch__($L__) and $ch__($R__) then is($L__ $S__ $R__) else "bad"; to $p__
22
  !endif
23
 !else
24
  p__=!append line "not_comparison"; to $p__
25
 !endif
26
!next i__
27
 
28
out__=!exec maxima $p__
29
 
30
!for i__=1 to $n__
31
 l__=!line $i__ of $out__
32
 !if $l__ notwordof true false
33
  l__=bad
34
 !endif
35
 out=!append line $l__ to $out
36
!next i__
37