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 := \mathsf{fma}\left(x, y, z \cdot t\right)\\
\mathbf{if}\;\begin{array}{l}
t_2 := c \cdot \left(a + b \cdot c\right)\\
t_2 \leq -7.459318381162668 \cdot 10^{+217} \lor \neg \left(t_2 \leq 1.046166375227898 \cdot 10^{+212}\right)
\end{array}:\\
\;\;\;\;2 \cdot \left(t_1 - c \cdot \left(c \cdot \left(b \cdot i\right) + a \cdot i\right)\right)\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \left(t_1 - i \cdot \left(c \cdot \left(b \cdot c\right) + a \cdot c\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
(let* ((t_1 (fma x y (* z t))))
(if (let* ((t_2 (* c (+ a (* b c)))))
(or (<= t_2 -7.459318381162668e+217)
(not (<= t_2 1.046166375227898e+212))))
(* 2.0 (- t_1 (* c (+ (* c (* b i)) (* a i)))))
(* 2.0 (- t_1 (* i (+ (* c (* b c)) (* a c))))))))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 = fma(x, y, (z * t));
double t_2 = c * (a + (b * c));
double tmp;
if ((t_2 <= -7.459318381162668e+217) || !(t_2 <= 1.046166375227898e+212)) {
tmp = 2.0 * (t_1 - (c * ((c * (b * i)) + (a * i))));
} else {
tmp = 2.0 * (t_1 - (i * ((c * (b * c)) + (a * c))));
}
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
| Original | 6.2 |
|---|---|
| Target | 2.0 |
| Herbie | 1.0 |
if (*.f64 (+.f64 a (*.f64 b c)) c) < -7.4593183811626683e217 or 1.04616637522789809e212 < (*.f64 (+.f64 a (*.f64 b c)) c) Initial program 34.1
Simplified34.1
Taylor expanded in c around 0 26.2
Simplified5.8
Taylor expanded in c around 0 3.7
if -7.4593183811626683e217 < (*.f64 (+.f64 a (*.f64 b c)) c) < 1.04616637522789809e212Initial program 0.4
Simplified0.4
Applied fma-udef_binary640.4
Applied distribute-lft-in_binary640.4
Final simplification1.0
herbie shell --seed 2021275
(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))))