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

Off one in the doc? #851

Open
keepsimple1 opened this issue Aug 12, 2024 · 0 comments
Open

Off one in the doc? #851

keepsimple1 opened this issue Aug 12, 2024 · 0 comments

Comments

@keepsimple1
Copy link

/// Exponentiates a field element `f` by a number represented with `u64`
/// limbs, using a precomputed table containing as many powers of 2 of
/// `f` as the 1 + the floor of log2 of the exponent `exp`, starting
/// from the 1st power. That is, `powers_of_2` should equal `&[p, p^2,
/// p^4, ..., p^(2^n)]` when `exp` has at most `n` bits.
///
/// This returns `None` when a power is missing from the table.
#[inline]
fn pow_with_table<S: AsRef<[u64]>>(powers_of_2: &[Self], exp: S) -> Option<Self> {

In line 336, it says:
...when `exp` has at most `n` bits.

If I understand, it should say:
...when `exp` has at most `n+1` bits.

For example:
when exp is 2, the powers_of_2 should be &[p, p^2]. Here n is 1, and exp (2, i.e. binary 10) has n+1 = 2 bits.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant