File: numexp

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 (94 lines) | stat: -rw-r--r-- 2,206 bytes parent folder | download | duplicates (2)
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
86
87
88
89
90
91
92
93
94
!!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