Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
|
|
@ -0,0 +1,42 @@
|
|||
' Trabb Pardo-Knuth algorithm
|
||||
PROGRAM "tpkalgorithm"
|
||||
VERSION "0.0001"
|
||||
|
||||
IMPORT "xma"
|
||||
|
||||
DECLARE FUNCTION Entry ()
|
||||
INTERNAL FUNCTION SINGLE F(SINGLE n)
|
||||
|
||||
FUNCTION Entry ()
|
||||
' Used "magic numbers" because of strict specification of the algorithm.
|
||||
SINGLE s[10]
|
||||
SINGLE tmp, r
|
||||
UBYTE i
|
||||
PRINT "Enter 11 numbers."
|
||||
FOR i = 0 TO 10
|
||||
PRINT i + 1;
|
||||
s[i] = SINGLE(INLINE$(" => "))
|
||||
NEXT i
|
||||
PRINT
|
||||
' Reverse
|
||||
FOR i = 0 TO 10 / 2
|
||||
tmp = s[i]
|
||||
s[i] = s[10 - i]
|
||||
s[10 - i] = tmp
|
||||
NEXT i
|
||||
'Results
|
||||
FOR i = 0 TO 10
|
||||
PRINT "f("; LTRIM$(STR$(s[i])); ") =";
|
||||
r = F(s[i])
|
||||
IF r > 400 THEN
|
||||
PRINT " overflow"
|
||||
ELSE
|
||||
PRINT r
|
||||
END IF
|
||||
NEXT i
|
||||
END FUNCTION
|
||||
|
||||
FUNCTION SINGLE F(SINGLE n)
|
||||
RETURN SQRT(ABS(n)) + 5 * n * n *n
|
||||
END FUNCTION
|
||||
END PROGRAM
|
||||
Loading…
Add table
Add a link
Reference in a new issue