17 lines
463 B
Plaintext
17 lines
463 B
Plaintext
function f(atom x)
|
|
return sqrt(abs(x))+5*power(x,3)
|
|
end function
|
|
|
|
string s = substitute(prompt_string("Enter 11 numbers:"),","," ")
|
|
sequence S = scanf(s,"%f %f %f %f %f %f %f %f %f %f %f")
|
|
if length(S)!=1 then puts(1,"not 11 numbers") abort(0) end if
|
|
S = reverse(S[1])
|
|
for i=1 to length(S) do
|
|
atom result = f(S[i])
|
|
if result>400 then
|
|
printf(1,"f(%g):overflow\n",{S[i]})
|
|
else
|
|
printf(1,"f(%g):%g\n",{S[i],result})
|
|
end if
|
|
end for
|