おっと、精度的にやってしまった。この解だと、「意味のある0」という概念が飛んで来るから不適当か?
対応させたものはこちら。2つ目の例で11じゃなく10なのは、11桁目は精度上のゴミだから。
#module
#defcfunc under_digit double a, local b,local c,local d
b=a
c=wpeek(b,6)
c&=32767
c>>4
c-=1<<10
d=logf(2)/logf(10)*c
d=-d+15
return d
#defcfunc udigit double a, local b, local c, local d,local e
d=under_digit(a)
b=1+d //もし、ゴミでも必要であるという場合は、2あるいは3程度に変更することも可
c=strf(strf("%%.%df",b),a)
repeat
if strmid(c,-1,1)!="0"{
break
}
c=strmid(c,0,strlen(c)-1)
loop
return strlen(c)-instr(c,0,".")-1
#global
a=0.12345678901234567890
b=-543210.1234567890234567890
mes under_digit(a)
mes udigit(a)
mes strf("%.20f",a)
mes under_digit(b)
mes udigit(b)
mes strf("%.20f",b)
mes under_digit(0.123400052000000)
mes udigit(0.123400052000000)