Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bellpepper-emulated: Fix overflow calculations #50

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

avras
Copy link
Collaborator

@avras avras commented Apr 22, 2024

The calculation of overflow had some errors. I have added a document in emulated/docs describing the changes. Here are some salient ones.

  • EmulatedFieldElement::max_overflow now returns F::CAPACITY as usize - P::bits_per_limb() - 3 instead of F::CAPACITY as usize - P::bits_per_limb()
  • The next_overflow for subtraction is changed from a.overflow.max(b.overflow + 2) to a.overflow.max(b.overflow + 1) + 1.
  • The padding constant used in sub_padding has changed.
  • The limb-wise equality check uses different values for the max_value and number of carry bits.

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