rust-num / num-traits

Numeric traits for generic mathematics in Rust
Apache License 2.0
731 stars 135 forks source link

Implement missing functionality for Float/FloatCore #340

Open tyilo opened 1 month ago

tyilo commented 1 month ago

My project currently uses both num_traits::FloatCore and the funty::Floating traits, as neither have all the functionality that I need.

I would like to drop the funty dependency, but this requires the following missing items:

pub trait Float {
    const MANTISSA_DIGITS: u32;
    type Bits: One + WrappingAdd + WrappingSub + LowerHex; // Probably need a better bound
    fn to_bits(self) -> Self::Bits;
    fn from_bits(bits: Self::Bits) -> Self;
}