The correct way to do this is:
fun fact_till (a,b) = if a = b
then 1
else a * fact_till(a - 1, b)
This can also be done with a case statement, if you wish:
fun fact_till (a,b) = case a = b of
true => 1
| false => a * fact_till(a - 1, b)