\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 -5.868557331434209 \cdot 10^{+160}:\\
\;\;\;\;\left(a \cdot 27\right) \cdot b + \left(x \cdot 2 - \left(y \cdot 9\right) \cdot \left(z \cdot t\right)\right)\\
\mathbf{elif}\;\left(y \cdot 9\right) \cdot z \leq 4.8483994624021507 \cdot 10^{+179}:\\
\;\;\;\;\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + a \cdot \left(27 \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;\left(a \cdot 27\right) \cdot b + \left(x \cdot 2 + y \cdot \left(z \cdot \left(t \cdot -9\right)\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) -5.868557331434209e+160)
(+ (* (* a 27.0) b) (- (* x 2.0) (* (* y 9.0) (* z t))))
(if (<= (* (* y 9.0) z) 4.8483994624021507e+179)
(+ (- (* x 2.0) (* (* (* y 9.0) z) t)) (* a (* 27.0 b)))
(+ (* (* a 27.0) b) (+ (* x 2.0) (* y (* z (* t -9.0))))))))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) <= -5.868557331434209e+160) {
tmp = ((a * 27.0) * b) + ((x * 2.0) - ((y * 9.0) * (z * t)));
} else if (((y * 9.0) * z) <= 4.8483994624021507e+179) {
tmp = ((x * 2.0) - (((y * 9.0) * z) * t)) + (a * (27.0 * b));
} else {
tmp = ((a * 27.0) * b) + ((x * 2.0) + (y * (z * (t * -9.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
Results
| Original | 3.5 |
|---|---|
| Target | 2.7 |
| Herbie | 0.7 |
| Alternative 1 | |
|---|---|
| Error | 1.1 |
| Cost | 3778 |
| Alternative 2 | |
|---|---|
| Error | 4.3 |
| Cost | 1986 |
| Alternative 3 | |
|---|---|
| Error | 4.3 |
| Cost | 1672 |
| Alternative 4 | |
|---|---|
| Error | 11.7 |
| Cost | 1160 |
| Alternative 5 | |
|---|---|
| Error | 11.7 |
| Cost | 1160 |
| Alternative 6 | |
|---|---|
| Error | 18.2 |
| Cost | 576 |
| Alternative 7 | |
|---|---|
| Error | 61.9 |
| Cost | 64 |
| Alternative 8 | |
|---|---|
| Error | 61.9 |
| Cost | 64 |

if (*.f64 (*.f64 y 9) z) < -5.868557331434209e160Initial program 18.6
rmApplied associate-*l*_binary64_215021.8
Simplified1.8
if -5.868557331434209e160 < (*.f64 (*.f64 y 9) z) < 4.84839946240215068e179Initial program 0.5
rmApplied associate-*l*_binary64_215020.5
Simplified0.5
if 4.84839946240215068e179 < (*.f64 (*.f64 y 9) z) Initial program 21.8
rmApplied associate-*l*_binary64_2150221.6
rmApplied sub-neg_binary64_2155421.6
Simplified1.5
Simplified1.5
Final simplification0.7
herbie shell --seed 2021044
(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)))