2 \cdot \left(\left(x \cdot y + z \cdot t\right) - \left(\left(a + b \cdot c\right) \cdot c\right) \cdot i\right)
\begin{array}{l}
\mathbf{if}\;\left(\left(a + b \cdot c\right) \cdot c\right) \cdot i = -\infty:\\
\;\;\;\;\mathsf{fma}\left(2 \cdot x, y, 2 \cdot \left(\left(-\mathsf{fma}\left(c, b, a\right)\right) \cdot \left(c \cdot i\right)\right)\right)\\
\mathbf{elif}\;\left(\left(a + b \cdot c\right) \cdot c\right) \cdot i \le 1.26303150478254523 \cdot 10^{304}:\\
\;\;\;\;2 \cdot \left(\left(x \cdot y + z \cdot t\right) - \left(\left(a + b \cdot c\right) \cdot c\right) \cdot i\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(2, \mathsf{fma}\left(x, y, z \cdot t\right), 2 \cdot \left(\left(-\sqrt[3]{\mathsf{fma}\left(c, b, a\right)} \cdot \sqrt[3]{\mathsf{fma}\left(c, b, a\right)}\right) \cdot \left(\left(\sqrt[3]{\mathsf{fma}\left(c, b, a\right)} \cdot c\right) \cdot i\right)\right)\right)\\
\end{array}double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return ((double) (2.0 * ((double) (((double) (((double) (x * y)) + ((double) (z * t)))) - ((double) (((double) (((double) (a + ((double) (b * c)))) * c)) * i))))));
}
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double VAR;
if ((((double) (((double) (((double) (a + ((double) (b * c)))) * c)) * i)) <= -inf.0)) {
VAR = ((double) fma(((double) (2.0 * x)), y, ((double) (2.0 * ((double) (((double) -(((double) fma(c, b, a)))) * ((double) (c * i))))))));
} else {
double VAR_1;
if ((((double) (((double) (((double) (a + ((double) (b * c)))) * c)) * i)) <= 1.2630315047825452e+304)) {
VAR_1 = ((double) (2.0 * ((double) (((double) (((double) (x * y)) + ((double) (z * t)))) - ((double) (((double) (((double) (a + ((double) (b * c)))) * c)) * i))))));
} else {
VAR_1 = ((double) fma(2.0, ((double) fma(x, y, ((double) (z * t)))), ((double) (2.0 * ((double) (((double) -(((double) (((double) cbrt(((double) fma(c, b, a)))) * ((double) cbrt(((double) fma(c, b, a)))))))) * ((double) (((double) (((double) cbrt(((double) fma(c, b, a)))) * c)) * i))))))));
}
VAR = VAR_1;
}
return VAR;
}




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.3 |
|---|---|
| Target | 1.7 |
| Herbie | 1.9 |
if (* (* (+ a (* b c)) c) i) < -inf.0Initial program 64.0
Simplified9.3
Taylor expanded around inf 9.3
Simplified9.3
Taylor expanded around inf 59.1
Simplified15.0
if -inf.0 < (* (* (+ a (* b c)) c) i) < 1.2630315047825452e+304Initial program 0.4
if 1.2630315047825452e+304 < (* (* (+ a (* b c)) c) i) Initial program 61.7
Simplified8.2
rmApplied add-cube-cbrt9.0
Applied distribute-lft-neg-in9.0
Applied associate-*l*8.9
rmApplied associate-*r*17.6
Final simplification1.9
herbie shell --seed 2020122 +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))))