File: function

package info (click to toggle)
wims 2%3A4.29a%2Bdfsg1-3
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 185,704 kB
  • sloc: xml: 366,687; javascript: 120,570; ansic: 62,341; java: 62,170; sh: 7,744; perl: 3,937; yacc: 3,217; cpp: 1,915; lex: 1,805; makefile: 1,084; lisp: 914; pascal: 601; python: 520; php: 318; asm: 7
file content (85 lines) | stat: -rw-r--r-- 1,750 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
option:integer symbols=" "

rg1=!item 1 of $(replygood$i)
rg2=!item 2 to -1 of $(replygood$i)
replyGood$i=!rawmath $rg1
vars=!varlist nofn $rg1
!if $rg2 != $empty
  vars2=!varlist nofn $rg2
  vars=!listuniq $vars, $vars2
!endif
!! one looks for the range for each variable
vars2cnt=!itemcnt $vars2
!for vf=1 to $vars2cnt
  varsr=!item $vf of $rg2
  varsr=!replace internal = by , in $(varsr)
  varsrange$(varsr[1])=!declosing $(varsr[2])
!next
n=!itemcnt $vars
!for vf=1 to $n
  !default varsrange$(vars[$vf])=$leftrange,$rightrange
!next
wims_rawmath_variables=$vars
reply$i=!rawmath $(reply$i)
reply$i=!mathsubst I=i in $(reply$i)

m_reply$i=$(reply$i)
!if $wims_read_parm=nocompare
  !exit
!endif

tf=$(reply$i)
vars_=!varlist nofn $tf
!set test=!listcomplement $vars in $vars_

!if $test!=$empty
  test=NaN bad_variable
  !exit
!endif

gf=$rg1
test=0
!for t=1 to $testnum
  tt=$tf
  gt=$gf
  !for j=1 to $n
    v=!item $j of $vars
    vr_=!itemcnt $(varsrange$v)
    !if $vr_ <= 2
      vt=!random $(varsrange$v)
      !if integer iswordof $(replyoption$i)
        vt=!randint $(varsrange$v)
      !endif
    !else
      vt=!randitem $(varsrange$v)
    !endif
    !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
  tt=$[$tt]
  test=$[$test+abs($tt-($gt))]
!next t
test=$[$test/$testnum]

!if NaN notin $test and inf 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
!else
  !reset test
  diareply$i=bad
!endif