Exact bounds checking for `xs:integer` operations.

Should fix Issue #760. Please read thoroughly before merging.