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}\;c \le 2.4693420887247912 \cdot 10^{-98}:\\
\;\;\;\;\mathsf{fma}\left(2, \mathsf{fma}\left(t, z, x \cdot y\right), \left(2 \cdot \left(\left(-\mathsf{fma}\left(c, b, a\right)\right) \cdot \left(c \cdot \left(\sqrt[3]{i} \cdot \sqrt[3]{i}\right)\right)\right)\right) \cdot \sqrt[3]{i}\right)\\
\mathbf{elif}\;c \le 8.5463068787004626 \cdot 10^{134}:\\
\;\;\;\;\mathsf{fma}\left(2, \mathsf{fma}\left(t, z, x \cdot y\right), \left(-2\right) \cdot \mathsf{fma}\left(i \cdot b, {c}^{2}, a \cdot \left(i \cdot c\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(2, \mathsf{fma}\left(t, z, x \cdot y\right), 2 \cdot \left(\left(-\mathsf{fma}\left(c, b, a\right) \cdot c\right) \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 ((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 ((c <= 2.4693420887247912e-98)) {
VAR = ((double) fma(2.0, ((double) fma(t, z, ((double) (x * y)))), ((double) (((double) (2.0 * ((double) (((double) -(((double) fma(c, b, a)))) * ((double) (c * ((double) (((double) cbrt(i)) * ((double) cbrt(i)))))))))) * ((double) cbrt(i))))));
} else {
double VAR_1;
if ((c <= 8.546306878700463e+134)) {
VAR_1 = ((double) fma(2.0, ((double) fma(t, z, ((double) (x * y)))), ((double) (((double) -(2.0)) * ((double) fma(((double) (i * b)), ((double) pow(c, 2.0)), ((double) (a * ((double) (i * c))))))))));
} else {
VAR_1 = ((double) fma(2.0, ((double) fma(t, z, ((double) (x * y)))), ((double) (2.0 * ((double) (((double) -(((double) (((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.0 |
|---|---|
| Target | 1.8 |
| Herbie | 3.8 |
if c < 2.4693420887247912e-98Initial program 4.0
Simplified1.4
Taylor expanded around inf 1.4
Simplified1.4
rmApplied add-cube-cbrt1.7
Applied associate-*r*1.7
Applied associate-*r*1.9
Applied associate-*r*1.9
if 2.4693420887247912e-98 < c < 8.546306878700463e+134Initial program 5.8
Simplified2.2
Taylor expanded around inf 2.2
Simplified2.2
rmApplied add-cube-cbrt2.6
Applied associate-*r*2.6
Applied associate-*r*2.2
Applied associate-*r*2.2
Taylor expanded around inf 4.4
Simplified2.6
if 8.546306878700463e+134 < c Initial program 31.3
Simplified4.3
Taylor expanded around inf 4.3
Simplified4.3
rmApplied associate-*r*31.3
Simplified31.3
Final simplification3.8
herbie shell --seed 2020114 +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))))