antibase=:{{
exponent=.<.x ^. y
numstr=.''
for_i. i.30 do.
quot=.<.y % x ^ (exponent - i)
y=.y |~ x ^ (exponent - i)
numstr=.numstr , ":quot
if. 0 = exponent - i do.
numstr=.numstr , '.'
end.
end.
if. '.' = {:numstr do.
numstr=.}:numstr
end.
numstr
}}"0
digits=:(,":"+i.10) , (a. {~ 97+i.26)
antibase=:{{
'base (x) should be greater than 1 and no more than 36' assert (>&1*.<:&36) x
sign=.'_' #~ (y < 0)
target=.y=.|y
maxexp=.0 >. <.x ^. y
xstr=.":!.40 x
numstr=.''
for_exp. maxexp - i.50 do.
if. 0 >:!.0 target - (". ::0 xstr,'b',numstr) do. break. end.
'quot y'=.y (<.@:%;|~) x ^ exp
numstr=.numstr , (quot { digits)
if. 0 = exp do.
numstr=.numstr , '.'
end.
end.
if. '.' = {:numstr do.
numstr=.}:numstr
end.
sign , numstr
}}"0
1.0201111212000000121011020010202112110
1.3 - 1x1b1.020111121200000012101102001020211211 NB. without the trailing 0
2.22045e_16
1.3 - 1x1b1.0201111212000000121011020010202112110 NB. adding back the trailing 0 changes the result(!)
_2.22045e_16
I'm afraid I have no clue what's happening here.
Either way, I've had good fun coming up with a solution for this; I may try to turn it into a tacit at some point!
Kind regards,
Helen
To unsubscribe from this group and stop receiving emails from it, send an email to forum+un...@jsoftware.com.