-
Notifications
You must be signed in to change notification settings - Fork 2
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
[Field] Converting 'negative' finite field elements to negative integers #68
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm.
p = natVal @p Proxy | ||
i = GF.fromP f | ||
asInteger x | ||
| i < p `Prelude.div` 2 = Just i |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does the edge case of i == p `Prelude.div` 2
matter here. I am not sure.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I started checking that and realized the whole test is broken and doesn't test what it's supposed to. Will fix.
301b40e
to
007a8b7
Compare
Ready for another review. Now we have a test that shows how overflows are handled and the old test now uses |
Now
asInteger (toInteger (-1) :: AField Jubjub.F)
givesJust (-1)
instead of52435875175126190479447740508185965837690552500527637822603658699938581184512
.