fn two_prod(a: f64, b: f64) -> (f64, f64)Examples found in repository?
crates/competitive/src/num/quad_double.rs (line 182)
181 fn mul(self, rhs: f64) -> Self::Output {
182 let (t0, e0) = two_prod(self.0, rhs);
183 let (p1, e1) = two_prod(self.1, rhs);
184 let (p2, e2) = two_prod(self.2, rhs);
185 let p3 = self.3 * rhs;
186
187 let (t1, e4) = two_sum(p1, e0);
188 let (t2, e5, e6) = three_three_sum(p2, e1, e4);
189 let (t3, e7) = three_two_sum(p3, e2, e5);
190 let t4 = e7 + e6;
191 Self::renormalize(t0, t1, t2, t3, t4)
192 }
193}
194
195impl Mul<QuadDouble> for QuadDouble {
196 type Output = Self;
197 fn mul(self, rhs: Self) -> Self::Output {
198 let (t0, q00) = two_prod(self.0, rhs.0);
199
200 let (p01, q01) = two_prod(self.0, rhs.1);
201 let (p10, q10) = two_prod(self.1, rhs.0);
202
203 let (p02, q02) = two_prod(self.0, rhs.2);
204 let (p11, q11) = two_prod(self.1, rhs.1);
205 let (p20, q20) = two_prod(self.2, rhs.0);
206
207 let (p03, q03) = two_prod(self.0, rhs.3);
208 let (p12, q12) = two_prod(self.1, rhs.2);
209 let (p21, q21) = two_prod(self.2, rhs.1);
210 let (p30, q30) = two_prod(self.3, rhs.0);
211
212 let p13 = self.1 * rhs.3;
213 let p22 = self.2 * rhs.2;
214 let p31 = self.3 * rhs.1;
215
216 let (t1, e1, e2) = three_three_sum(q00, p01, p10);
217 let (t2, e3, e4) = multiple_three_sum(&[e1, q01, q10, p02, p11, p20]);
218 let (t3, e5) = multiple_two_sum(&[e2, e3, q02, q11, q20, p03, p12, p21, p30]);
219 let t4 = e4 + e5 + q03 + q12 + q21 + q30 + p13 + p22 + p31;
220 Self::renormalize(t0, t1, t2, t3, t4)
221 }