\left(\left(\left(\left(\left(\left(x \cdot 18\right) \cdot y\right) \cdot z\right) \cdot t - \left(a \cdot 4\right) \cdot t\right) + b \cdot c\right) - \left(x \cdot 4\right) \cdot i\right) - \left(j \cdot 27\right) \cdot k
\begin{array}{l}
\mathbf{if}\;z \leq -1.2979464893330037 \cdot 10^{-36}:\\
\;\;\;\;t \cdot \left(\sqrt[3]{z \cdot \left(\left(x \cdot 18\right) \cdot y\right)} \cdot \left(\sqrt[3]{z \cdot \left(\left(x \cdot 18\right) \cdot y\right)} \cdot \sqrt[3]{z \cdot \left(\left(x \cdot 18\right) \cdot y\right)}\right) - a \cdot 4\right) + \left(b \cdot c - \left(\left(x \cdot 4\right) \cdot i + \left(j \cdot 27\right) \cdot k\right)\right)\\
\mathbf{elif}\;z \leq 4.1346406395579365 \cdot 10^{-63} \lor \neg \left(z \leq 2.0911460381468777 \cdot 10^{+264}\right):\\
\;\;\;\;\left(b \cdot c - \left(\left(x \cdot 4\right) \cdot i + \left(j \cdot 27\right) \cdot k\right)\right) + t \cdot \left(\left(x \cdot 18\right) \cdot \left(z \cdot y\right) - a \cdot 4\right)\\
\mathbf{else}:\\
\;\;\;\;t \cdot \left(z \cdot \left(\left(x \cdot 18\right) \cdot y\right) - a \cdot 4\right) + \left(b \cdot c - \left(\left(x \cdot 4\right) \cdot i + j \cdot \left(27 \cdot k\right)\right)\right)\\
\end{array}(FPCore (x y z t a b c i j k) :precision binary64 (- (- (+ (- (* (* (* (* x 18.0) y) z) t) (* (* a 4.0) t)) (* b c)) (* (* x 4.0) i)) (* (* j 27.0) k)))
(FPCore (x y z t a b c i j k)
:precision binary64
(if (<= z -1.2979464893330037e-36)
(+
(*
t
(-
(*
(cbrt (* z (* (* x 18.0) y)))
(* (cbrt (* z (* (* x 18.0) y))) (cbrt (* z (* (* x 18.0) y)))))
(* a 4.0)))
(- (* b c) (+ (* (* x 4.0) i) (* (* j 27.0) k))))
(if (or (<= z 4.1346406395579365e-63) (not (<= z 2.0911460381468777e+264)))
(+
(- (* b c) (+ (* (* x 4.0) i) (* (* j 27.0) k)))
(* t (- (* (* x 18.0) (* z y)) (* a 4.0))))
(+
(* t (- (* z (* (* x 18.0) y)) (* a 4.0)))
(- (* b c) (+ (* (* x 4.0) i) (* j (* 27.0 k))))))))double code(double x, double y, double z, double t, double a, double b, double c, double i, double j, double k) {
return (((((((x * 18.0) * y) * z) * t) - ((a * 4.0) * t)) + (b * c)) - ((x * 4.0) * i)) - ((j * 27.0) * k);
}
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j, double k) {
double tmp;
if (z <= -1.2979464893330037e-36) {
tmp = (t * ((cbrt(z * ((x * 18.0) * y)) * (cbrt(z * ((x * 18.0) * y)) * cbrt(z * ((x * 18.0) * y)))) - (a * 4.0))) + ((b * c) - (((x * 4.0) * i) + ((j * 27.0) * k)));
} else if ((z <= 4.1346406395579365e-63) || !(z <= 2.0911460381468777e+264)) {
tmp = ((b * c) - (((x * 4.0) * i) + ((j * 27.0) * k))) + (t * (((x * 18.0) * (z * y)) - (a * 4.0)));
} else {
tmp = (t * ((z * ((x * 18.0) * y)) - (a * 4.0))) + ((b * c) - (((x * 4.0) * i) + (j * (27.0 * k))));
}
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




Bits error versus j




Bits error versus k
Results
| Original | 5.6 |
|---|---|
| Target | 1.5 |
| Herbie | 4.1 |
if z < -1.29794648933300373e-36Initial program 6.2
Simplified6.2
rmApplied add-cube-cbrt_binary646.4
if -1.29794648933300373e-36 < z < 4.13464063955793648e-63 or 2.0911460381468777e264 < z Initial program 5.0
Simplified5.0
rmApplied associate-*l*_binary641.8
if 4.13464063955793648e-63 < z < 2.0911460381468777e264Initial program 6.1
Simplified6.1
rmApplied associate-*l*_binary646.1
Final simplification4.1
herbie shell --seed 2020268
(FPCore (x y z t a b c i j k)
:name "Diagrams.Solve.Polynomial:cubForm from diagrams-solve-0.1, E"
:precision binary64
:herbie-target
(if (< t -1.6210815397541398e-69) (- (- (* (* 18.0 t) (* (* x y) z)) (* (+ (* a t) (* i x)) 4.0)) (- (* (* k j) 27.0) (* c b))) (if (< t 165.68027943805222) (+ (- (* (* 18.0 y) (* x (* z t))) (* (+ (* a t) (* i x)) 4.0)) (- (* c b) (* 27.0 (* k j)))) (- (- (* (* 18.0 t) (* (* x y) z)) (* (+ (* a t) (* i x)) 4.0)) (- (* (* k j) 27.0) (* c b)))))
(- (- (+ (- (* (* (* (* x 18.0) y) z) t) (* (* a 4.0) t)) (* b c)) (* (* x 4.0) i)) (* (* j 27.0) k)))