fn three_two_sum(a: f64, b: f64, c: f64) -> (f64, f64)Examples found in repository?
crates/competitive/src/num/double_double.rs (line 82)
80 fn add(self, rhs: Self) -> Self::Output {
81 let (t0, e) = two_sum(self.0, rhs.0);
82 let (t1, t2) = three_two_sum(self.1, rhs.1, e);
83 Self::renormalize(t0, t1, t2)
84 }
85}
86
87impl Sub for DoubleDouble {
88 type Output = Self;
89 fn sub(self, rhs: Self) -> Self::Output {
90 self + -rhs
91 }
92}
93
94impl Neg for DoubleDouble {
95 type Output = Self;
96 fn neg(self) -> Self::Output {
97 Self(-self.0, -self.1)
98 }
99}
100
101impl Mul<f64> for DoubleDouble {
102 type Output = Self;
103 fn mul(self, rhs: f64) -> Self::Output {
104 let (t0, e0) = two_prod(self.0, rhs);
105 let p1 = self.1 * rhs;
106 let (t1, t2) = two_sum(p1, e0);
107 Self::renormalize(t0, t1, t2)
108 }
109}
110
111impl Mul<DoubleDouble> for DoubleDouble {
112 type Output = Self;
113 fn mul(self, rhs: Self) -> Self::Output {
114 let (t0, q00) = two_prod(self.0, rhs.0);
115 let (p01, q01) = two_prod(self.0, rhs.1);
116 let (p10, q10) = two_prod(self.1, rhs.0);
117 let p11 = self.1 * rhs.1;
118 let (t1, e1) = three_two_sum(q00, p01, p10);
119 let t2 = e1 + q01 + q10 + p11;
120 Self::renormalize(t0, t1, t2)
121 }