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 -2.484056664408104 \cdot 10^{+118}:\\
\;\;\;\;2 \cdot \left(\left(x \cdot y + z \cdot t\right) - c \cdot \left(i \cdot \left(a + c \cdot b\right)\right)\right)\\
\mathbf{elif}\;c \leq 2.4408878131790536 \cdot 10^{+41}:\\
\;\;\;\;2 \cdot \left(\left(x \cdot y + z \cdot t\right) - i \cdot \left(c \cdot \left(a + c \cdot b\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \left(\left(x \cdot y + z \cdot t\right) - \left(a + c \cdot b\right) \cdot \left(c \cdot i\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 (<= c -2.484056664408104e+118)
(* 2.0 (- (+ (* x y) (* z t)) (* c (* i (+ a (* c b))))))
(if (<= c 2.4408878131790536e+41)
(* 2.0 (- (+ (* x y) (* z t)) (* i (* c (+ a (* c b))))))
(* 2.0 (- (+ (* x y) (* z t)) (* (+ a (* c b)) (* c i)))))))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 (c <= -2.484056664408104e+118) {
tmp = 2.0 * (((x * y) + (z * t)) - (c * (i * (a + (c * b)))));
} else if (c <= 2.4408878131790536e+41) {
tmp = 2.0 * (((x * y) + (z * t)) - (i * (c * (a + (c * b)))));
} else {
tmp = 2.0 * (((x * y) + (z * t)) - ((a + (c * b)) * (c * i)));
}
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.7 |
|---|---|
| Target | 2.0 |
| Herbie | 2.3 |
if c < -2.48405666440810399e118Initial program 35.2
Taylor expanded around 0 49.7
Simplified4.8
if -2.48405666440810399e118 < c < 2.44088781317905363e41Initial program 1.7
if 2.44088781317905363e41 < c Initial program 24.0
Taylor expanded around inf 5.0
Final simplification2.3
herbie shell --seed 2021014
(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))))