Avoid integer overflow when dealing with very large systems
Merge pull request #581 from peastman/master

Avoid integer overflow when dealing with very large systems