Implement basic overflow computation. Closes #1148.

This adds just 4 ms out of ~120 ms on the rainbow page.

r? @kmcallister