\frac{\left(\left(x \cdot 9\right) \cdot y - \left(\left(z \cdot 4\right) \cdot t\right) \cdot a\right) + b}{z \cdot c}\begin{array}{l}
\mathbf{if}\;\frac{\left(\left(x \cdot 9\right) \cdot y - \left(\left(z \cdot 4\right) \cdot t\right) \cdot a\right) + b}{z \cdot c} = -inf.0:\\
\;\;\;\;\left(\frac{b}{z \cdot c} + 9 \cdot \frac{x}{z \cdot \frac{c}{y}}\right) - 4 \cdot \frac{a}{\frac{c}{t}}\\
\mathbf{elif}\;\frac{\left(\left(x \cdot 9\right) \cdot y - \left(\left(z \cdot 4\right) \cdot t\right) \cdot a\right) + b}{z \cdot c} \le -7.89569842135674297 \cdot 10^{-301}:\\
\;\;\;\;\frac{\left(\left(x \cdot 9\right) \cdot y - \left(\left(z \cdot 4\right) \cdot t\right) \cdot a\right) + b}{z \cdot c}\\
\mathbf{elif}\;\frac{\left(\left(x \cdot 9\right) \cdot y - \left(\left(z \cdot 4\right) \cdot t\right) \cdot a\right) + b}{z \cdot c} \le 3.6756499733293384 \cdot 10^{25}:\\
\;\;\;\;\left(\frac{b + \left(x \cdot 9\right) \cdot y}{z} - 4 \cdot \left(t \cdot a\right)\right) \cdot \frac{1}{c}\\
\mathbf{elif}\;\frac{\left(\left(x \cdot 9\right) \cdot y - \left(\left(z \cdot 4\right) \cdot t\right) \cdot a\right) + b}{z \cdot c} \le 2.45666433204328895 \cdot 10^{282}:\\
\;\;\;\;\frac{\left(\left(x \cdot 9\right) \cdot y - \left(\left(z \cdot 4\right) \cdot t\right) \cdot a\right) + b}{z \cdot c}\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{b}{z \cdot c} + 9 \cdot \frac{x}{z \cdot \frac{c}{y}}\right) - 4 \cdot \frac{a}{\frac{c}{t}}\\
\end{array}double code(double x, double y, double z, double t, double a, double b, double c) {
return (((double) (((double) (((double) (((double) (x * 9.0)) * y)) - ((double) (((double) (((double) (z * 4.0)) * t)) * a)))) + b)) / ((double) (z * c)));
}
double code(double x, double y, double z, double t, double a, double b, double c) {
double VAR;
if (((((double) (((double) (((double) (((double) (x * 9.0)) * y)) - ((double) (((double) (((double) (z * 4.0)) * t)) * a)))) + b)) / ((double) (z * c))) <= -inf.0)) {
VAR = ((double) (((double) ((b / ((double) (z * c))) + ((double) (9.0 * (x / ((double) (z * (c / y)))))))) - ((double) (4.0 * (a / (c / t))))));
} else {
double VAR_1;
if (((((double) (((double) (((double) (((double) (x * 9.0)) * y)) - ((double) (((double) (((double) (z * 4.0)) * t)) * a)))) + b)) / ((double) (z * c))) <= -7.895698421356743e-301)) {
VAR_1 = (((double) (((double) (((double) (((double) (x * 9.0)) * y)) - ((double) (((double) (((double) (z * 4.0)) * t)) * a)))) + b)) / ((double) (z * c)));
} else {
double VAR_2;
if (((((double) (((double) (((double) (((double) (x * 9.0)) * y)) - ((double) (((double) (((double) (z * 4.0)) * t)) * a)))) + b)) / ((double) (z * c))) <= 3.6756499733293384e+25)) {
VAR_2 = ((double) (((double) ((((double) (b + ((double) (((double) (x * 9.0)) * y)))) / z) - ((double) (4.0 * ((double) (t * a)))))) * (1.0 / c)));
} else {
double VAR_3;
if (((((double) (((double) (((double) (((double) (x * 9.0)) * y)) - ((double) (((double) (((double) (z * 4.0)) * t)) * a)))) + b)) / ((double) (z * c))) <= 2.456664332043289e+282)) {
VAR_3 = (((double) (((double) (((double) (((double) (x * 9.0)) * y)) - ((double) (((double) (((double) (z * 4.0)) * t)) * a)))) + b)) / ((double) (z * c)));
} else {
VAR_3 = ((double) (((double) ((b / ((double) (z * c))) + ((double) (9.0 * (x / ((double) (z * (c / y)))))))) - ((double) (4.0 * (a / (c / t))))));
}
VAR_2 = VAR_3;
}
VAR_1 = VAR_2;
}
VAR = VAR_1;
}
return VAR;
}




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
Results
| Original | 20.8 |
|---|---|
| Target | 14.7 |
| Herbie | 3.7 |
if (/ (+ (- (* (* x 9.0) y) (* (* (* z 4.0) t) a)) b) (* z c)) < -inf.0 or 2.45666433204328895e282 < (/ (+ (- (* (* x 9.0) y) (* (* (* z 4.0) t) a)) b) (* z c)) Initial program 60.0
Simplified26.5
Taylor expanded around 0 29.3
rmApplied associate-/l*24.7
rmApplied associate-/l*14.4
Simplified11.7
if -inf.0 < (/ (+ (- (* (* x 9.0) y) (* (* (* z 4.0) t) a)) b) (* z c)) < -7.89569842135674297e-301 or 3.6756499733293384e25 < (/ (+ (- (* (* x 9.0) y) (* (* (* z 4.0) t) a)) b) (* z c)) < 2.45666433204328895e282Initial program 0.7
if -7.89569842135674297e-301 < (/ (+ (- (* (* x 9.0) y) (* (* (* z 4.0) t) a)) b) (* z c)) < 3.6756499733293384e25Initial program 18.9
Simplified0.8
rmApplied div-inv0.9
Final simplification3.7
herbie shell --seed 2020182
(FPCore (x y z t a b c)
:name "Diagrams.Solve.Polynomial:cubForm from diagrams-solve-0.1, J"
:precision binary64
:herbie-target
(if (< (/ (+ (- (* (* x 9.0) y) (* (* (* z 4.0) t) a)) b) (* z c)) -1.1001567408041051e-171) (/ (+ (- (* (* x 9.0) y) (* (* z 4.0) (* t a))) b) (* z c)) (if (< (/ (+ (- (* (* x 9.0) y) (* (* (* z 4.0) t) a)) b) (* z c)) -0.0) (/ (/ (+ (- (* (* x 9.0) y) (* (* (* z 4.0) t) a)) b) z) c) (if (< (/ (+ (- (* (* x 9.0) y) (* (* (* z 4.0) t) a)) b) (* z c)) 1.1708877911747488e-53) (/ (+ (- (* (* x 9.0) y) (* (* z 4.0) (* t a))) b) (* z c)) (if (< (/ (+ (- (* (* x 9.0) y) (* (* (* z 4.0) t) a)) b) (* z c)) 2.876823679546137e+130) (- (+ (* (* 9.0 (/ y c)) (/ x z)) (/ b (* c z))) (* 4.0 (/ (* a t) c))) (if (< (/ (+ (- (* (* x 9.0) y) (* (* (* z 4.0) t) a)) b) (* z c)) 1.3838515042456319e+158) (/ (+ (- (* (* x 9.0) y) (* (* z 4.0) (* t a))) b) (* z c)) (- (+ (* 9.0 (* (/ y (* c z)) x)) (/ b (* c z))) (* 4.0 (/ (* a t) c))))))))
(/ (+ (- (* (* x 9.0) y) (* (* (* z 4.0) t) a)) b) (* z c)))