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) - \left(a + b \cdot c\right) \cdot \left(c \cdot i\right)\right)\\
\mathbf{elif}\;c \cdot \left(a + b \cdot c\right) \leq 2.59268021622475 \cdot 10^{+246}:\\
\;\;\;\;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) - c \cdot \left(c \cdot \left(b \cdot i\right) + \frac{i}{a}\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 (* b c)) (* c i))))
(if (<= (* c (+ a (* b c))) 2.59268021622475e+246)
(* 2.0 (- (+ (* x y) (* z t)) (* (* c (+ a (* b c))) i)))
(* 2.0 (- (+ (* x y) (* z t)) (* c (+ (* c (* b i)) (/ i a))))))))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 + (b * c)) * (c * i)));
} else if ((c * (a + (b * c))) <= 2.59268021622475e+246) {
tmp = 2.0 * (((x * y) + (z * t)) - ((c * (a + (b * c))) * i));
} else {
tmp = 2.0 * (((x * y) + (z * t)) - (c * ((c * (b * i)) + (i / a))));
}
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.7 |
|---|---|
| Target | 1.9 |
| Herbie | 2.8 |
if (*.f64 (+.f64 a (*.f64 b c)) c) < -inf.0Initial program 64.0
rmApplied associate-*l*_binary64_1502311.8
if -inf.0 < (*.f64 (+.f64 a (*.f64 b c)) c) < 2.59268021622474992e246Initial program 0.4
if 2.59268021622474992e246 < (*.f64 (+.f64 a (*.f64 b c)) c) Initial program 42.0
Taylor expanded around inf 52.4
Simplified25.2
Final simplification2.8
herbie shell --seed 2020344
(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))))