Replace the $2 in your comparisons with $gettok($2,$calc($numtok($2,46) - 2),46)

I think that should get what you're looking for