初期値を0に限定せず、小数の末尾の0を省略した表記にしたいということなら、
こんな形になるでしょうか。
//関数:realopt(p1,p2)
//p1の実数を、電卓のような表記(末尾の0を省略した表記)の文字列にして返す。
//p2は小数部分の最大桁数(省略可能。省略時は8)
#module
#define global ctype realopt(%1,%2=8) _realopt(%1,%2)
#defcfunc _realopt double a,int _b,local c,local d
b=limit(_b,0,512)
c=strf("%."+str(b)+"f",a)
d=0
repeat b
if peek(c,strlen(c)-1-cnt)!='0' {
d=b-cnt
break
}
loop
return strf("%."+str(d)+"f",a)
#global
a=0.0 //任意の数値に変更して可
text=realopt(a)
pos 0,0 : objsize 200,30
input text
pos 0,30 : objsize 60,30
button gosub "入力",*ent
stop
*ent
a=double(text)
dialog a
return