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

Set and multiply signs of a BigInt #226

Open
virchau13 opened this issue Oct 27, 2021 · 0 comments
Open

Set and multiply signs of a BigInt #226

virchau13 opened this issue Oct 27, 2021 · 0 comments

Comments

@virchau13
Copy link

Currently, the only way to directly change the sign of a BigInt is to use.into_parts() and then BigInt::from_biguint(). It would be more convenient if we could directly set the sign, via a .set_sign() method or similar.

Especially for equations where terms of (-1)ⁿ are present, it would also be more convenient if there was a Mul<Sign> and MulAssign<Sign> impl so that one can e.g.

let minus_1_coef: Sign = Sign::Minus;
let answer: BigInt;
// ...
loop { 
    minus_1_coef = -minus_1_coef;
    answer *= minus_1_coef;
    // ...
}
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