clamp the value when trying to calc ratio