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}\;i \leq -3.0819729376635466 \cdot 10^{-49}:\\
\;\;\;\;2 \cdot \left(t_1 - i \cdot \left(c \cdot \left(c \cdot b\right) + c \cdot a\right)\right)\\
\mathbf{elif}\;i \leq 2.578892516458991 \cdot 10^{+25}:\\
\;\;\;\;2 \cdot \left(t_1 - c \cdot \left(c \cdot \left(i \cdot b\right) + i \cdot a\right)\right)\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \left(t_1 - i \cdot \left(c \cdot a + b \cdot {c}^{2}\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 (<= i -3.0819729376635466e-49)
(* 2.0 (- t_1 (* i (+ (* c (* c b)) (* c a)))))
(if (<= i 2.578892516458991e+25)
(* 2.0 (- t_1 (* c (+ (* c (* i b)) (* i a)))))
(* 2.0 (- t_1 (* i (+ (* c a) (* b (pow c 2.0))))))))))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 tmp;
if (i <= -3.0819729376635466e-49) {
tmp = 2.0 * (t_1 - (i * ((c * (c * b)) + (c * a))));
} else if (i <= 2.578892516458991e+25) {
tmp = 2.0 * (t_1 - (c * ((c * (i * b)) + (i * a))));
} else {
tmp = 2.0 * (t_1 - (i * ((c * a) + (b * pow(c, 2.0)))));
}
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.1 |
|---|---|
| Target | 2.0 |
| Herbie | 1.6 |
if i < -3.0819729376635466e-49Initial program 1.1
Simplified1.1
Applied fma-udef_binary641.1
Applied distribute-lft-in_binary641.1
if -3.0819729376635466e-49 < i < 2.57889251645899121e25Initial program 9.7
Simplified9.7
Taylor expanded in c around 0 8.8
Simplified1.9
Applied fma-udef_binary641.9
Applied distribute-rgt-in_binary641.9
Simplified1.4
Simplified1.4
if 2.57889251645899121e25 < i Initial program 0.8
Simplified0.8
Taylor expanded in i around 0 2.9
Final simplification1.6
herbie shell --seed 2021340
(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))))