entry ; COMMENT .SEC(CVT.SAI - floating number conversion with 0 elimination) .index(CVT.SAI - floating number conversion with 0 elimination) .; begin "CVT.sai" Comment R. Gordon; comment returns a String representing a real number with zeros trimmed off; Internal String Procedure CVT( real a ); begin "CVT" String b; integer i,user!width,user!digits; String Procedure trim!off!left( String b,character ); begin "trim!off" while equ(b[1 for 1],character) do b_b[2 to inf]; return(b); end "trim!off"; String Procedure trim!off!right( String b,character ); begin "trim!off" while equ(b[length(b) for 1],character) do b_b[1 to length(b)-1]; return(b); end "trim!off"; if a=0 then return("0"); getformat(user!width,user!digits); setformat(14,8); b_trim!off!left(trim!off!right(cvg(a)," ")," "); setformat(user!width,user!digits); for i_ 1 step 1 until length(b) do if equ(b[i for 1],"@") then return(trim!off!right(trim!off!left(trim!off!right( b[1 to i-1],"0"),"0"),".") & b[i to inf]); return(trim!off!right(trim!off!left(trim!off!right(b,"0"),"0"),".") ); end "CVT"; end "CVT.sai";