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}\;c \leq -3.7048220371515083 \cdot 10^{-34} \lor \neg \left(c \leq 7.834458098323896 \cdot 10^{-93}\right):\\
\;\;\;\;2 \cdot \left(x \cdot y + \left(z \cdot t - c \cdot \left(\left(a + c \cdot b\right) \cdot i\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \left(\left(x \cdot y + z \cdot t\right) - i \cdot \left(c \cdot \left(a + c \cdot b\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 (<= c -3.7048220371515083e-34) (not (<= c 7.834458098323896e-93))) (* 2.0 (+ (* x y) (- (* z t) (* c (* (+ a (* c b)) i))))) (* 2.0 (- (+ (* x y) (* z t)) (* i (* c (+ a (* c b))))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return ((double) (2.0 * ((double) (((double) (((double) (x * y)) + ((double) (z * t)))) - ((double) (((double) (((double) (a + ((double) (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 (((c <= -3.7048220371515083e-34) || !(c <= 7.834458098323896e-93))) {
tmp = ((double) (2.0 * ((double) (((double) (x * y)) + ((double) (((double) (z * t)) - ((double) (c * ((double) (((double) (a + ((double) (c * b)))) * i))))))))));
} else {
tmp = ((double) (2.0 * ((double) (((double) (((double) (x * y)) + ((double) (z * t)))) - ((double) (i * ((double) (c * ((double) (a + ((double) (c * b))))))))))));
}
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
Results
| Original | 6.4 |
|---|---|
| Target | 1.9 |
| Herbie | 1.7 |
if c < -3.7048220371515083e-34 or 7.8344580983238958e-93 < c Initial program Error: 13.8 bits
SimplifiedError: 3.3 bits
if -3.7048220371515083e-34 < c < 7.8344580983238958e-93Initial program Error: 0.5 bits
Final simplificationError: 1.7 bits
herbie shell --seed 2020203
(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))))