Skip to content

Commit

Permalink
docs: add explanation of field arithmetic
Browse files Browse the repository at this point in the history
  • Loading branch information
bobbinth committed Jan 11, 2024
1 parent 78608e5 commit 88779a1
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions docs/src/user_docs/assembly/field_operations.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ If the error code is omitted, the default value of $0$ is assumed.

### Arithmetic and Boolean operations

The arithmetic operations below are performed in a 64-bit [prime filed](https://en.wikipedia.org/wiki/Finite_field) defined by modulus $p = 2^{64} - 2^{32} + 1$. This means that overflow happens after a value exceeds $p$. Also, the result of divisions may appear counter-intuitive because divisions are defined via inversions.

| Instruction | Stack_input | Stack_output | Notes |
| ------------------------------------------------------------------------------ | ----------- | ------------- | ------------------------------------------------------------------------------------------------------------ |
| add <br> - *(1 cycle)* <br> add.*b* <br> - *(1-2 cycle)* | [b, a, ...] | [c, ...] | $c \leftarrow (a + b) \mod p$ |
Expand Down

0 comments on commit 88779a1

Please sign in to comment.