Arithmetic evaluation: Difference between revisions
Content added Content deleted
Line 1,325: | Line 1,325: | ||
# |
# |
||
subr ntok |
subr ntok |
||
while ch$ = " " |
|||
nch |
|||
. |
|||
if ch >= 48 and ch <= 58 |
|||
tok$ = "n" |
|||
s$ = "" |
|||
while ch >= 48 and ch <= 58 or ch$ = "." |
|||
s$ &= ch$ |
|||
⚫ | |||
while ch >= 48 and ch <= 58 or ch$ = "." |
|||
s$ &= ch$ |
|||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
nch |
nch |
||
. |
. |
||
⚫ | |||
elif ch = 0 |
|||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
. |
. |
||
. |
. |
||
Line 1,392: | Line 1,390: | ||
. |
. |
||
ntok |
ntok |
||
else |
|||
⚫ | |||
print "error: factor expected, got " & tok$ |
|||
. |
. |
||
return nd |
return nd |
||
Line 1,452: | Line 1,453: | ||
. |
. |
||
input_data |
input_data |
||
4 * |
4 * |
||
4.2 * ((5.3+8)*3 + 4) |
4.2 * ((5.3+8)*3 + 4) |
||
2.5 * 2 + 2 * 3.14 |
2.5 * 2 + 2 * 3.14 |