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}\;\begin{array}{l}
t_1 := c \cdot \left(a + b \cdot c\right)\\
t_1 \leq -2.820513469907538 \cdot 10^{+301} \lor \neg \left(t_1 \leq 1.3625788941162508 \cdot 10^{+113}\right)
\end{array}:\\
\;\;\;\;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}:\\
\;\;\;\;2 \cdot \left(\mathsf{fma}\left(x, y, t \cdot z\right) - i \cdot \left(c \cdot \mathsf{fma}\left(b, c, a\right)\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 (let* ((t_1 (* c (+ a (* b c)))))
(or (<= t_1 -2.820513469907538e+301)
(not (<= t_1 1.3625788941162508e+113))))
(* 2.0 (- (fma t z (* y x)) (* c (+ (* c (* b i)) (* a i)))))
(* 2.0 (- (fma x y (* t z)) (* i (* c (fma b c 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 t_1 = c * (a + (b * c));
double tmp;
if ((t_1 <= -2.820513469907538e+301) || !(t_1 <= 1.3625788941162508e+113)) {
tmp = 2.0 * (fma(t, z, (y * x)) - (c * ((c * (b * i)) + (a * i))));
} else {
tmp = 2.0 * (fma(x, y, (t * z)) - (i * (c * fma(b, c, 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
| Original | 6.4 |
|---|---|
| Target | 1.8 |
| Herbie | 1.3 |
if (*.f64 (+.f64 a (*.f64 b c)) c) < -2.8205134699075379e301 or 1.3625788941162508e113 < (*.f64 (+.f64 a (*.f64 b c)) c) Initial program 31.5
Simplified31.5
Taylor expanded in x around 0 24.8
Simplified6.3
Taylor expanded in c around 0 5.0
if -2.8205134699075379e301 < (*.f64 (+.f64 a (*.f64 b c)) c) < 1.3625788941162508e113Initial program 0.4
Simplified0.4
Final simplification1.3
herbie shell --seed 2021274
(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))))