systemstring(127)fnspec rtos(real r,integer n,m)
systemstring(127)fn rtof(real x, integer n)
real y,round
integer count=-99,sign=0
string(127) result=""
!
if x # 0 start
x = -x and sign = 1 if x < 0
!Adjust X so that 1.0 <= rounded(X) < 10.0
count = 0; round = 0.5¬{^}n
y = 1.0-round
if x < y start; !ie rounded(X) < 1.0
count = count-1 and x = x*10.0 until x >= y
finish else start
y = 10.0-round
while x >= y cycle; !ie rounded(X) > 10.0
count = count+1; x = x/10.0
repeat
finish
x = -x if sign # 0
finish
result = rtos(x,1,n)
result = result."@".itos(count,0)
result = result
end; !flrtos
endoffile