Skip to content

relaxing the trait bounds on Complex::Add and friends #124

Open
@sarah-quinones

Description

@sarah-quinones

at the moment, all the core arithmetic operations for Complex require the Num bound to be satisfied
https://docs.rs/num-complex/latest/num_complex/struct.Complex.html#impl-Add-for-Complex%3CT%3E

this is stronger than it needs to be, and implementing that can be difficult for new numerical types like qd::Double<f64>, due to the Num::from_str_radix being nontrivial to implement

would it be acceptable to relax the constraint to Add<Output = Self> for addition, Sub<Output = Self> for subtraction, and Mul<Output = Self> + Add<Output = Self> + Sub<Output = Self> for multiplication?

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