dimforge / simba

Set of mathematical traits to facilitate the use of SIMD-based AoSoA (Array of Struct of Array) storage pattern.
Apache License 2.0
293 stars 29 forks source link

Remove Bounded requirement from RealField #25

Closed boomshroom closed 3 years ago

boomshroom commented 3 years ago

While most types would have minimum and maximum values, arbitrary precision types can be useful to drop into an existing function when they're needed. Obviously, arbitrary precision types lack defined minimum and maximum values preventing them from implementing RealField, and since ComplexField also requires declaring the wrapped RealField, ComplexField isn't implementable either even though it doesn't directly depend on Bounded.

The rug crate has had to close multiple issues requesting the implementation of Float from num-traits for exactly this reason.

sebcrozet commented 3 years ago

That make sense. Let’s remove the Bounded requirement. And let’s add two new methods to RealField that would replace that Bounded requirement:

fn max_value() -> Option<Self>;
fn min_value() -> Option<Self>;