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}\;i \leq -1558263795518608400 \lor \neg \left(i \leq 3.860982310378207 \cdot 10^{+95}\right):\\
\;\;\;\;2 \cdot \left(\left(x \cdot y + z \cdot t\right) - i \cdot \left(c \cdot \left(a + b \cdot c\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \left(\mathsf{fma}\left(t, z, x \cdot y\right) - c \cdot \left(i \cdot \mathsf{fma}\left(c, b, 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 (or (<= i -1558263795518608400.0) (not (<= i 3.860982310378207e+95))) (* 2.0 (- (+ (* x y) (* z t)) (* i (* c (+ a (* b c)))))) (* 2.0 (- (fma t z (* x y)) (* c (* i (fma c b 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 ((i <= -1558263795518608400.0) || !(i <= 3.860982310378207e+95)) {
tmp = 2.0 * (((x * y) + (z * t)) - (i * (c * (a + (b * c)))));
} else {
tmp = 2.0 * (fma(t, z, (x * y)) - (c * (i * fma(c, b, 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.6 |
|---|---|
| Target | 1.9 |
| Herbie | 1.7 |
if i < -1558263795518608400 or 3.86098231037820712e95 < i Initial program 0.8
if -1558263795518608400 < i < 3.86098231037820712e95Initial program 9.0
Simplified9.0
Taylor expanded in x around 0 9.2
Simplified2.0
Final simplification1.7
herbie shell --seed 2021291
(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))))