(phixonline)-->
function f(atom x)
return sqrt(abs(x))+5*power(x,3)
end function
procedure test(string s, bool fake_prompt=true)
if fake_prompt then printf(1,"Enter 11 numbers:%s\n",{s}) end if
s = substitute(s,","," ")
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
puts(1,"\n")
end procedure
--test(prompt_string("Enter 11 numbers:"),false)
constant tests = {"10 -1 1 2 3 4 4.3 4.305 4.303 4.302 4.301","1,2,3,4,5,6,7,8,9,10,11",
"0.470145,1.18367,2.36984,4.86759,2.40274,5.48793,3.30256,5.34393,4.21944,2.23501,-0.0200707"}
papply(tests,test)