Made lib.math.constrain to do the best job it can. How do we want to document this?