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}
t_1 := x \cdot y + z \cdot t\\
t_2 := a + b \cdot c\\
t_3 := \left(c \cdot t_2\right) \cdot i\\
\mathbf{if}\;t_3 \leq -\infty:\\
\;\;\;\;2 \cdot \left(t_1 - t_2 \cdot \left(c \cdot i\right)\right)\\
\mathbf{elif}\;t_3 \leq 5.29042202284554 \cdot 10^{+307}:\\
\;\;\;\;2 \cdot \left(t_1 - t_3\right)\\
\mathbf{else}:\\
\;\;\;\;\begin{array}{l}
t_4 := \sqrt{c \cdot \left(t_2 \cdot i\right)}\\
2 \cdot \left(t_1 - t_4 \cdot t_4\right)
\end{array}\\
\end{array}
(FPCore (x y z t a b c i) :precision binary64 (* 2.0 (- (+ (* x y) (* z t)) (* (* (+ a (* b c)) c) i))))
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (+ (* x y) (* z t))) (t_2 (+ a (* b c))) (t_3 (* (* c t_2) i)))
(if (<= t_3 (- INFINITY))
(* 2.0 (- t_1 (* t_2 (* c i))))
(if (<= t_3 5.29042202284554e+307)
(* 2.0 (- t_1 t_3))
(let* ((t_4 (sqrt (* c (* t_2 i))))) (* 2.0 (- t_1 (* t_4 t_4))))))))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 t_1 = (x * y) + (z * t);
double t_2 = a + (b * c);
double t_3 = (c * t_2) * i;
double tmp;
if (t_3 <= -((double) INFINITY)) {
tmp = 2.0 * (t_1 - (t_2 * (c * i)));
} else if (t_3 <= 5.29042202284554e+307) {
tmp = 2.0 * (t_1 - t_3);
} else {
double t_4 = sqrt(c * (t_2 * i));
tmp = 2.0 * (t_1 - (t_4 * t_4));
}
return tmp;
}




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 | 1.2 |
if (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < -inf.0Initial program 64.0
rmApplied associate-*l*_binary649.9
if -inf.0 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 5.29042202284553989e307Initial program 0.3
rmApplied add-cube-cbrt_binary640.6
Simplified0.6
Simplified0.6
rmApplied *-un-lft-identity_binary640.6
Applied associate-*r*_binary640.6
Simplified0.3
if 5.29042202284553989e307 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) Initial program 63.8
rmApplied add-sqr-sqrt_binary6463.8
Simplified63.8
Simplified10.1
Final simplification1.2
herbie shell --seed 2021190
(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.0 (- (+ (* x y) (* z t)) (* (+ a (* b c)) (* c i))))
(* 2.0 (- (+ (* x y) (* z t)) (* (* (+ a (* b c)) c) i))))