Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
|
|
@ -0,0 +1,27 @@
|
|||
Module Input11 {
|
||||
Flush ' empty stack
|
||||
For I=1 to 11 {
|
||||
Input "Give me a number ", a
|
||||
Data a ' add to bottom of stack, use: Push a to add to top, to get reverse order here
|
||||
}
|
||||
}
|
||||
Module Run {
|
||||
Print "Trabb Pardo–Knuth algorithm"
|
||||
Print "f(x)=Sqrt(Abs(x))+5*x^3"
|
||||
if not match("NNNNNNNNN") then Error "Need 11 numbers"
|
||||
Shiftback 1, -11 ' reverse order 11 elements of stack of values
|
||||
Def f(x)=Sqrt(Abs(x))+5*x^3
|
||||
For i=1 to 11 {
|
||||
Read pop
|
||||
y=f(pop)
|
||||
if y>400 Then {
|
||||
Print format$("f({0}) = Overflow!", pop)
|
||||
} Else {
|
||||
Print format$("f({0}) = {1}", pop, y)
|
||||
}
|
||||
}
|
||||
}
|
||||
Run 10, -1, 1, 2, 3, 4, 4.3, 4.305, 4.303, 4.302, 4.301
|
||||
Run 1, 2, 3, -4.55,5.1111, 6, -7, 8, 9, 10, 11
|
||||
Input11
|
||||
Run
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
Global a$
|
||||
Document a$ ' make a$ as a document - string with paragraphs
|
||||
Module Run {
|
||||
a$<={Trabb Pardo–Knuth algorithm
|
||||
f(x)=Sqrt(Abs(x))+5*x^3
|
||||
}
|
||||
if not match("NNNNNNNNN") then Error "Need 11 numbers"
|
||||
Shiftback 1, -11 ' reverse order 11 elements of stack of values
|
||||
Def f(x)=Sqrt(Abs(x))+5*x^3
|
||||
For i=1 to 11 {
|
||||
Read pop
|
||||
y=f(pop)
|
||||
if y>400 Then {
|
||||
a$<=format$("f({0}) = Overflow!", pop)+{
|
||||
}
|
||||
} Else {
|
||||
a$<=format$("f({0}) = {1}", pop, y)+{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Run 10, -1, 1, 2, 3, 4, 4.3, 4.305, 4.303, 4.302, 4.301
|
||||
Run 1, 2, 3, -4.55,5.1111, 6, -7, 8, 9, 10, 11
|
||||
Clipboard a$
|
||||
Loading…
Add table
Add a link
Reference in a new issue