Skip to content

How to achieve a % b, where a, b are frontend.Variable #1362

Answered by ivokub
drakstik asked this question in Q&A
Discussion options

You must be logged in to vote

What are the value ranges you are performing operations in? Keep in mind that frontend.Variable value are defined in a finite field defined by the elliptic curve used for generating the proof. For example when use use BN254 for generating the proof then the operations are in the scalar field of BN254, which is mod 21888242871839275222246405745257275088548364400416034343698204186575808495617.

If the operations you define are small (and in your example it seems they may be as you work with a grid and want to use it for the grid size?), then you can essentially compute using native arithmetic (as you never over or underflow).

There is a very similar discussion happening in #1361. You could f…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@drakstik
Comment options

@drakstik
Comment options

Answer selected by drakstik
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants