2 \cdot \left(\left(x \cdot y + z \cdot t\right) - \left(\left(a + b \cdot c\right) \cdot c\right) \cdot i\right)
\mathsf{fma}\left(2, \mathsf{fma}\left(x, y, z \cdot t\right), \sqrt{\sqrt{2}} \cdot \left(\sqrt{\sqrt{2}} \cdot \left(\left(\sqrt{2} \cdot \left(-\mathsf{fma}\left(c, b, a\right)\right)\right) \cdot \left(c \cdot i\right)\right)\right)\right)double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return (2.0 * (((x * y) + (z * t)) - (((a + (b * c)) * c) * i)));
}
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return fma(2.0, fma(x, y, (z * t)), (sqrt(sqrt(2.0)) * (sqrt(sqrt(2.0)) * ((sqrt(2.0) * -fma(c, b, a)) * (c * i)))));
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t




Bits error versus a




Bits error versus b




Bits error versus c




Bits error versus i
Results
| Original | 6.2 |
|---|---|
| Target | 1.9 |
| Herbie | 2.0 |
Initial program 6.2
Simplified1.9
rmApplied add-sqr-sqrt2.2
Applied associate-*l*2.1
rmApplied add-sqr-sqrt2.1
Applied sqrt-prod1.9
Applied associate-*l*1.9
rmApplied associate-*r*2.0
Final simplification2.0
herbie shell --seed 2020060 +o rules:numerics
(FPCore (x y z t a b c i)
:name "Diagrams.ThreeD.Shapes:frustum from diagrams-lib-1.3.0.3, A"
:precision binary64
:herbie-target
(* 2 (- (+ (* x y) (* z t)) (* (+ a (* b c)) (* c i))))
(* 2 (- (+ (* x y) (* z t)) (* (* (+ a (* b c)) c) i))))