30 lines
690 B
Plaintext
30 lines
690 B
Plaintext
module Pathological_floating_point_problems{
|
|
decimal vn[3]
|
|
vn[1]=2
|
|
vn[2]=-4
|
|
for i=3 to 100
|
|
vn[i]=111@-1130@/vn[i-1]+3000@/(vn[i-1]*vn[i-2])
|
|
next
|
|
n=list:=3,4,5,6,7,8,20,25
|
|
k=each(n)
|
|
while k
|
|
report "n = "+eval$(k)+chr$(9)+(vn[eval(k)])
|
|
end while
|
|
}
|
|
print "Task 1"
|
|
Pathological_floating_point_problems
|
|
print
|
|
print "Task 2"
|
|
module Chaotic_Bank_Society {
|
|
decimal Balance=2.7182818284590452353602874713@-1@
|
|
string frmt="year {0::-2} Balance:{1}"
|
|
for i=1 to 25
|
|
Balance=Balance*i-1@
|
|
rem print format$(frmt, i, Balance)
|
|
next i
|
|
Print "Starting balance: $e-1"
|
|
Print "Balance = (Balance * year) - 1 for 25 years"
|
|
print "Balance after 25 years: $"+Balance
|
|
}
|
|
Chaotic_Bank_Society
|