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 := \left(c \cdot \left(a + b \cdot c\right)\right) \cdot i\\
\mathbf{if}\;t_1 \leq -3.2895597596916134 \cdot 10^{+300}:\\
\;\;\;\;2 \cdot \left(\mathsf{fma}\left(t, z, y \cdot x\right) - c \cdot \left(c \cdot \left(b \cdot i\right) + a \cdot i\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\begin{array}{l}
t_2 := \mathsf{fma}\left(x, y, t \cdot z\right)\\
\mathbf{if}\;t_1 \leq 4.316811525763463 \cdot 10^{+296}:\\
\;\;\;\;2 \cdot \left(t_2 - i \cdot \left(c \cdot \mathsf{fma}\left(b, c, a\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\begin{array}{l}
t_3 := \sqrt{c \cdot \left(i \cdot \mathsf{fma}\left(c, b, a\right)\right)}\\
2 \cdot \left(t_2 - t_3 \cdot t_3\right)
\end{array}\\
\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 (* (* c (+ a (* b c))) i)))
(if (<= t_1 -3.2895597596916134e+300)
(* 2.0 (- (fma t z (* y x)) (* c (+ (* c (* b i)) (* a i)))))
(let* ((t_2 (fma x y (* t z))))
(if (<= t_1 4.316811525763463e+296)
(* 2.0 (- t_2 (* i (* c (fma b c a)))))
(let* ((t_3 (sqrt (* c (* i (fma c b a))))))
(* 2.0 (- t_2 (* t_3 t_3)))))))))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 = (c * (a + (b * c))) * i;
double tmp;
if (t_1 <= -3.2895597596916134e+300) {
tmp = 2.0 * (fma(t, z, (y * x)) - (c * ((c * (b * i)) + (a * i))));
} else {
double t_2 = fma(x, y, (t * z));
double tmp_1;
if (t_1 <= 4.316811525763463e+296) {
tmp_1 = 2.0 * (t_2 - (i * (c * fma(b, c, a))));
} else {
double t_3 = sqrt(c * (i * fma(c, b, a)));
tmp_1 = 2.0 * (t_2 - (t_3 * t_3));
}
tmp = tmp_1;
}
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 | 1.9 |
| Herbie | 1.1 |
if (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < -3.28955975969161342e300Initial program 60.2
Simplified60.2
Taylor expanded in x around 0 34.7
Simplified15.6
Taylor expanded in c around 0 5.5
if -3.28955975969161342e300 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 4.31681152576346306e296Initial program 0.4
Simplified0.3
if 4.31681152576346306e296 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) Initial program 57.3
Simplified57.3
Applied add-sqr-sqrt_binary6457.3
Simplified59.2
Simplified10.0
Final simplification1.1
herbie shell --seed 2021313
(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))))