\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 -1.2640897934873165 \cdot 10^{+189}:\\
\;\;\;\;\left(x \cdot 2 - \left(y \cdot 9\right) \cdot \left(z \cdot t\right)\right) + \left(a \cdot 27\right) \cdot b\\
\mathbf{elif}\;\left(y \cdot 9\right) \cdot z \leq 5.768366724569417 \cdot 10^{+26}:\\
\;\;\;\;\left(a \cdot 27\right) \cdot b + \left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right)\\
\mathbf{else}:\\
\;\;\;\;\left(a \cdot 27\right) \cdot b + \left(x \cdot 2 + y \cdot \left(t \cdot \left(z \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) -1.2640897934873165e+189)
(+ (- (* x 2.0) (* (* y 9.0) (* z t))) (* (* a 27.0) b))
(if (<= (* (* y 9.0) z) 5.768366724569417e+26)
(+ (* (* a 27.0) b) (- (* x 2.0) (* (* (* y 9.0) z) t)))
(+ (* (* a 27.0) b) (+ (* x 2.0) (* y (* t (* z -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) <= -1.2640897934873165e+189) {
tmp = ((x * 2.0) - ((y * 9.0) * (z * t))) + ((a * 27.0) * b);
} else if (((y * 9.0) * z) <= 5.768366724569417e+26) {
tmp = ((a * 27.0) * b) + ((x * 2.0) - (((y * 9.0) * z) * t));
} else {
tmp = ((a * 27.0) * b) + ((x * 2.0) + (y * (t * (z * -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.8 |
|---|---|
| Target | 2.7 |
| Herbie | 1.4 |
| Alternative 1 | |
|---|---|
| Accuracy | 0.9 |
| Cost | 1924 |
| Alternative 2 | |
|---|---|
| Accuracy | 3.8 |
| Cost | 1088 |
if (*.f64 (*.f64 y 9) z) < -1.26408979348731648e189Initial program 24.2
rmApplied associate-*l*_binary64_249121.3
if -1.26408979348731648e189 < (*.f64 (*.f64 y 9) z) < 5.7683667245694172e26Initial program 0.6
rmApplied *-un-lft-identity_binary64_249710.6
rmApplied pow1_binary64_250320.6
rmApplied *-un-lft-identity_binary64_249710.6
rmApplied pow1_binary64_250320.6
if 5.7683667245694172e26 < (*.f64 (*.f64 y 9) z) Initial program 9.5
rmApplied *-un-lft-identity_binary64_249719.5
rmApplied pow1_binary64_250329.5
rmApplied sub-neg_binary64_249649.5
Simplified4.5
Final simplification1.4
herbie shell --seed 2020338
(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)))