\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b
\begin{array}{l}
\mathbf{if}\;\left(y \cdot 9\right) \cdot z \leq -2.076476446964344 \cdot 10^{+256}:\\
\;\;\;\;\left(x \cdot 2 - y \cdot \left(t \cdot \left(9 \cdot z\right)\right)\right) + a \cdot \left(27 \cdot b\right)\\
\mathbf{elif}\;\left(y \cdot 9\right) \cdot z \leq 3.0974314158590182 \cdot 10^{+34}:\\
\;\;\;\;x \cdot 2 - \left(\left(9 \cdot t\right) \cdot \left(y \cdot z\right) - a \cdot \left(27 \cdot b\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot 2 + \left(a \cdot \left(27 \cdot b\right) - z \cdot \left(\left(y \cdot 9\right) \cdot t\right)\right)\\
\end{array}(FPCore (x y z t a b) :precision binary64 (+ (- (* x 2.0) (* (* (* y 9.0) z) t)) (* (* a 27.0) b)))
(FPCore (x y z t a b)
:precision binary64
(if (<= (* (* y 9.0) z) -2.076476446964344e+256)
(+ (- (* x 2.0) (* y (* t (* 9.0 z)))) (* a (* 27.0 b)))
(if (<= (* (* y 9.0) z) 3.0974314158590182e+34)
(- (* x 2.0) (- (* (* 9.0 t) (* y z)) (* a (* 27.0 b))))
(+ (* x 2.0) (- (* a (* 27.0 b)) (* z (* (* y 9.0) t)))))))double code(double x, double y, double z, double t, double a, double b) {
return ((x * 2.0) - (((y * 9.0) * z) * t)) + ((a * 27.0) * b);
}
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (((y * 9.0) * z) <= -2.076476446964344e+256) {
tmp = ((x * 2.0) - (y * (t * (9.0 * z)))) + (a * (27.0 * b));
} else if (((y * 9.0) * z) <= 3.0974314158590182e+34) {
tmp = (x * 2.0) - (((9.0 * t) * (y * z)) - (a * (27.0 * b)));
} else {
tmp = (x * 2.0) + ((a * (27.0 * b)) - (z * ((y * 9.0) * t)));
}
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
Results
| Original | 3.9 |
|---|---|
| Target | 2.7 |
| Herbie | 1.3 |
if (*.f64 (*.f64 y 9) z) < -2.0764764469643441e256Initial program 40.6
Simplified0.5
if -2.0764764469643441e256 < (*.f64 (*.f64 y 9) z) < 3.09743141585901823e34Initial program 0.5
Simplified3.5
Taylor expanded around 0 0.5
Simplified0.5
if 3.09743141585901823e34 < (*.f64 (*.f64 y 9) z) Initial program 10.1
Simplified5.0
Final simplification1.3
herbie shell --seed 2021176
(FPCore (x y z t a b)
:name "Diagrams.Solve.Polynomial:cubForm from diagrams-solve-0.1, A"
:precision binary64
:herbie-target
(if (< y 7.590524218811189e-161) (+ (- (* x 2.0) (* (* (* y 9.0) z) t)) (* a (* 27.0 b))) (+ (- (* x 2.0) (* 9.0 (* y (* t z)))) (* (* a 27.0) b)))
(+ (- (* x 2.0) (* (* (* y 9.0) z) t)) (* (* a 27.0) b)))