Skip to content

Consistent division and modulo#448

Merged
gauravpartha merged 1 commit into
masterfrom
consistent_division_modulo
Dec 28, 2022
Merged

Consistent division and modulo#448
gauravpartha merged 1 commit into
masterfrom
consistent_division_modulo

Conversation

@gauravpartha

Copy link
Copy Markdown
Contributor

Previously, Carbon always evaluated integer division and modulo using Scala if the divisor and dividend were integer literals (and the divisor is non-zero). If the divisor or the dividend are not integer literals, then Carbon uses Boogie's division, which uses the SMT division. Scala's division differs from the SMT division and so this leads to inconsistencies.

This pull request simplifies integer division and modulo only if the divisor and dividend are nonnegative (and the divisor is nonzero), which removes this inconsistency.

This issue was already reported in viperproject/silver#297.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant