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:\\
\;\;\;\;2 \cdot \left(\left(x \cdot y + z \cdot t\right) - \left(a + b \cdot c\right) \cdot \left(c \cdot i\right)\right)\\
\mathbf{elif}\;\left(\left(a + b \cdot c\right) \cdot c\right) \cdot i \le 4.4752237138994016 \cdot 10^{290}:\\
\;\;\;\;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}:\\
\;\;\;\;2 \cdot \left(\left(x \cdot y + z \cdot t\right) - \sqrt{\left(a + b \cdot c\right) \cdot \left(c \cdot i\right)} \cdot \sqrt{\left(a + b \cdot c\right) \cdot \left(c \cdot i\right)}\right)\\
\end{array}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) {
double VAR;
if (((((a + (b * c)) * c) * i) <= -inf.0)) {
VAR = (2.0 * (((x * y) + (z * t)) - ((a + (b * c)) * (c * i))));
} else {
double VAR_1;
if (((((a + (b * c)) * c) * i) <= 4.4752237138994016e+290)) {
VAR_1 = (2.0 * (((x * y) + (z * t)) - (((a + (b * c)) * c) * i)));
} else {
VAR_1 = (2.0 * (((x * y) + (z * t)) - (sqrt(((a + (b * c)) * (c * i))) * sqrt(((a + (b * c)) * (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 | 5.9 |
|---|---|
| Target | 1.7 |
| Herbie | 1.3 |
if (* (* (+ a (* b c)) c) i) < -inf.0Initial program 64.0
rmApplied associate-*l*12.2
if -inf.0 < (* (* (+ a (* b c)) c) i) < 4.4752237138994016e+290Initial program 0.3
if 4.4752237138994016e+290 < (* (* (+ a (* b c)) c) i) Initial program 54.1
rmApplied associate-*l*9.5
rmApplied add-sqr-sqrt9.7
Final simplification1.3
herbie shell --seed 2020100
(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))))