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 \cdot \left(a + b \cdot c\right) \leq -\infty:\\
\;\;\;\;2 \cdot \left(\left(x \cdot y + z \cdot t\right) - a \cdot \left(c \cdot i\right)\right)\\
\mathbf{elif}\;c \cdot \left(a + b \cdot c\right) \leq 4.871106677915747 \cdot 10^{+261}:\\
\;\;\;\;2 \cdot \left(\left(x \cdot y + z \cdot t\right) - \left(c \cdot \left(a + b \cdot c\right)\right) \cdot i\right)\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \left(\left(x \cdot y + z \cdot t\right) - \left(a + b \cdot c\right) \cdot \left(c \cdot i\right)\right)\\
\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
(if (<= (* c (+ a (* b c))) (- INFINITY))
(* 2.0 (- (+ (* x y) (* z t)) (* a (* c i))))
(if (<= (* c (+ a (* b c))) 4.871106677915747e+261)
(* 2.0 (- (+ (* x y) (* z t)) (* (* c (+ a (* b c))) i)))
(* 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 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 tmp;
if ((c * (a + (b * c))) <= -((double) INFINITY)) {
tmp = 2.0 * (((x * y) + (z * t)) - (a * (c * i)));
} else if ((c * (a + (b * c))) <= 4.871106677915747e+261) {
tmp = 2.0 * (((x * y) + (z * t)) - ((c * (a + (b * c))) * i));
} else {
tmp = 2.0 * (((x * y) + (z * t)) - ((a + (b * c)) * (c * i)));
}
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.3 |
|---|---|
| Target | 1.7 |
| Herbie | 2.3 |
if (*.f64 (+.f64 a (*.f64 b c)) c) < -inf.0Initial program 64.0
rmApplied associate-*l*_binary6410.1
Taylor expanded around 0 33.0
if -inf.0 < (*.f64 (+.f64 a (*.f64 b c)) c) < 4.8711066779157468e261Initial program 0.3
if 4.8711066779157468e261 < (*.f64 (+.f64 a (*.f64 b c)) c) Initial program 46.4
rmApplied associate-*l*_binary647.7
Final simplification2.3
herbie shell --seed 2020219
(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))))