make rational arithmetic use checked ops

This makes all rational arithmetic operations use checked integer operations to avoid overflow. Along with #8463, this should solve #2960.