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

chore(docs): Supplement descriptions for defaulting loop indices to be u64 #3237

Merged
merged 6 commits into from
Oct 26, 2023
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/docs/language_concepts/data_types/00_fields.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ The size of a Noir field depends on the elliptic curve's finite field for the pr
adopted. For example, a field would be a 254-bit integer when paired with the default backend that
spans the Grumpkin curve.

Fields support integer arithmetic and are often used as the default numeric type in Noir:
Fields support integer arithmetic:
Savio-Sou marked this conversation as resolved.
Show resolved Hide resolved

```rust
fn main(x : Field, y : Field) {
Expand Down
12 changes: 8 additions & 4 deletions docs/docs/language_concepts/data_types/01_integers.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,16 @@ keywords:
An integer type is a range constrained field type. The Noir frontend currently supports unsigned,
arbitrary-sized integer types.

> **Note:** When an integer is defined in Noir without a specific type, it would default to `u64`.
Savio-Sou marked this conversation as resolved.
Show resolved Hide resolved

An integer type is specified first with the letter `u`, indicating its unsigned nature, followed by
its length in bits (e.g. `32`). For example, a `u32` variable can store a value in the range of
$\\([0,2^{32}-1]\\)$:
$\\([0,2^{32}-1]\\)$.

> **Note:** The default proving backend supports both even (e.g. `u16`, `u48`) and odd (e.g. `u5`, `u3`)
> sized integer types.

Taking a look of how the type is used:

```rust
fn main(x : Field, y : u32) {
Expand All @@ -28,6 +35,3 @@ fn main(x : Field, y : u32) {
`x`, `y` and `z` are all private values in this example. However, `x` is a field while `y` and `z`
are unsigned 32-bit integers. If `y` or `z` exceeds the range $\\([0,2^{32}-1]\\)$, proofs created
will be rejected by the verifier.

> **Note:** The default backend supports both even (e.g. `u16`, `u48`) and odd (e.g. `u5`, `u3`)
> sized integer types.