hi
sorry about my language i don't speak verry well english
no need to "return $false"
u was declared %p local why u retype var %p down? type only %p = ...
the variable %y and %t just for len of number after the point?
put only "%t $mid($1,$pos($1,.,1),0) - 1"
no need $round($1,%t) type only $1 cz the %t is the len of number after the point
so
alias frac {
var %x 1,%t $mid($1,$pos($1,.,1),0) - 1,%p
while (%x) {
%p = $round($calc($v1 * $1),0)
if ($round($calc($+(%p,/,$v1)),%t) == $1) return $+(%p,/,%x)
inc %x
}
}