From 88779a1d30cd517aa553a3d9bb679e190c231cda Mon Sep 17 00:00:00 2001 From: Bobbin Threadbare Date: Wed, 10 Jan 2024 22:18:26 -0800 Subject: [PATCH] docs: add explanation of field arithmetic --- docs/src/user_docs/assembly/field_operations.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/src/user_docs/assembly/field_operations.md b/docs/src/user_docs/assembly/field_operations.md index a0ca6c7b00..96d8916f49 100644 --- a/docs/src/user_docs/assembly/field_operations.md +++ b/docs/src/user_docs/assembly/field_operations.md @@ -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
- *(1 cycle)*
add.*b*
- *(1-2 cycle)* | [b, a, ...] | [c, ...] | $c \leftarrow (a + b) \mod p$ |