Skip to content

Set and multiply signs of a BigInt #226

@virchau13

Description

@virchau13

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;
    // ...
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions