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

size is not the same as degree, but careless doc reader could make mistake #5831

Open
bennetyee opened this issue Aug 26, 2024 · 1 comment

Comments

@bennetyee
Copy link
Contributor

pub fn size(&self) -> usize {

because we don't trim high degree zeros, size does not return one more than the degree of the polynomial.

while this is not a bug, it feels like a potential foot gun for careless future users of this code.

@peternose
Copy link
Contributor

size does not return one more than the degree of the polynomial.

True. Size returns the size of the underlying vector, which is the same as the number of (zero and non-zero) coefficients in the polynomial. Again avoiding degree to have constant time operations.

    /// Returns the number of coefficients in the polynomial.
    pub fn size(&self) -> usize {

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

2 participants