const_soft_float/soft_f32/
impl_trait.rs

1use crate::soft_f32::SoftF32;
2
3type F = SoftF32;
4
5impl From<f32> for F {
6    fn from(value: f32) -> Self {
7        F::from_f32(value)
8    }
9}
10
11impl PartialEq<Self> for F {
12    fn eq(&self, other: &Self) -> bool {
13        match self.cmp(*other) {
14            Some(core::cmp::Ordering::Equal) => true,
15            _ => false,
16        }
17    }
18}
19
20impl PartialOrd for F {
21    fn partial_cmp(&self, other: &Self) -> Option<core::cmp::Ordering> {
22        self.cmp(*other)
23    }
24}
25
26impl core::ops::Add for F {
27    type Output = Self;
28
29    fn add(self, rhs: Self) -> Self::Output {
30        F::add(self, rhs)
31    }
32}
33
34impl core::ops::Sub for F {
35    type Output = Self;
36
37    fn sub(self, rhs: Self) -> Self::Output {
38        F::sub(self, rhs)
39    }
40}
41
42impl core::ops::Mul for F {
43    type Output = Self;
44
45    fn mul(self, rhs: Self) -> Self::Output {
46        F::mul(self, rhs)
47    }
48}
49
50impl core::ops::Div for F {
51    type Output = Self;
52
53    fn div(self, rhs: Self) -> Self::Output {
54        F::div(self, rhs)
55    }
56}
57
58impl core::ops::AddAssign for F {
59    fn add_assign(&mut self, rhs: Self) {
60        *self = *self + rhs;
61    }
62}
63
64impl core::ops::SubAssign for F {
65    fn sub_assign(&mut self, rhs: Self) {
66        *self = *self - rhs;
67    }
68}