\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} = -\infty:\\
\;\;\;\;\mathsf{fma}\left(-4, t \cdot \frac{a}{c}, \frac{\frac{\mathsf{fma}\left(9 \cdot x, y, b\right)}{z}}{c}\right)\\
\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.871851396527143 \cdot 10^{28}:\\
\;\;\;\;\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 7.1731194323305578 \cdot 10^{-211}:\\
\;\;\;\;\mathsf{fma}\left(-4, \frac{t \cdot a}{c}, \frac{\frac{9 \cdot \left(x \cdot y\right) + b}{z}}{c}\right)\\
\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 9.3925606351414175 \cdot 10^{297}:\\
\;\;\;\;\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}:\\
\;\;\;\;\mathsf{fma}\left(-4, t \cdot \frac{a}{c}, \frac{\frac{\mathsf{fma}\left(9 \cdot x, y, b\right)}{z}}{c}\right)\\
\end{array}double code(double x, double y, double z, double t, double a, double b, double c) {
return ((double) (((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) (((double) (x * 9.0)) * y)) - ((double) (((double) (((double) (z * 4.0)) * t)) * a)))) + b)) / ((double) (z * c)))) <= -inf.0)) {
VAR = ((double) fma(((double) -(4.0)), ((double) (t * ((double) (a / c)))), ((double) (((double) (((double) fma(((double) (9.0 * x)), y, b)) / z)) / c))));
} else {
double VAR_1;
if ((((double) (((double) (((double) (((double) (((double) (x * 9.0)) * y)) - ((double) (((double) (((double) (z * 4.0)) * t)) * a)))) + b)) / ((double) (z * c)))) <= -3.871851396527143e+28)) {
VAR_1 = ((double) (((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) (((double) (x * 9.0)) * y)) - ((double) (((double) (((double) (z * 4.0)) * t)) * a)))) + b)) / ((double) (z * c)))) <= 7.173119432330558e-211)) {
VAR_2 = ((double) fma(((double) -(4.0)), ((double) (((double) (t * a)) / c)), ((double) (((double) (((double) (((double) (9.0 * ((double) (x * y)))) + b)) / z)) / c))));
} else {
double VAR_3;
if ((((double) (((double) (((double) (((double) (((double) (x * 9.0)) * y)) - ((double) (((double) (((double) (z * 4.0)) * t)) * a)))) + b)) / ((double) (z * c)))) <= 9.392560635141417e+297)) {
VAR_3 = ((double) (((double) (((double) (((double) (((double) (x * 9.0)) * y)) - ((double) (((double) (((double) (z * 4.0)) * t)) * a)))) + b)) / ((double) (z * c))));
} else {
VAR_3 = ((double) fma(((double) -(4.0)), ((double) (t * ((double) (a / c)))), ((double) (((double) (((double) fma(((double) (9.0 * x)), y, b)) / z)) / c))));
}
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.6 |
|---|---|
| Target | 14.5 |
| Herbie | 6.6 |
if (/ (+ (- (* (* x 9.0) y) (* (* (* z 4.0) t) a)) b) (* z c)) < -inf.0 or 9.392560635141417e+297 < (/ (+ (- (* (* x 9.0) y) (* (* (* z 4.0) t) a)) b) (* z c)) Initial program 62.0
Simplified32.3
rmApplied associate-/r*27.9
Simplified27.9
rmApplied *-un-lft-identity27.9
Applied times-frac24.0
Simplified24.0
if -inf.0 < (/ (+ (- (* (* x 9.0) y) (* (* (* z 4.0) t) a)) b) (* z c)) < -3.871851396527143e+28 or 7.173119432330558e-211 < (/ (+ (- (* (* x 9.0) y) (* (* (* z 4.0) t) a)) b) (* z c)) < 9.392560635141417e+297Initial program 0.6
if -3.871851396527143e+28 < (/ (+ (- (* (* x 9.0) y) (* (* (* z 4.0) t) a)) b) (* z c)) < 7.173119432330558e-211Initial program 18.4
Simplified11.5
rmApplied associate-/r*0.7
Simplified0.7
rmApplied fma-udef0.7
Simplified0.7
Final simplification6.6
herbie shell --seed 2020121 +o rules:numerics
(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) y) (* (* (* z 4) t) a)) b) (* z c)) -1.1001567408041051e-171) (/ (+ (- (* (* x 9) y) (* (* z 4) (* t a))) b) (* z c)) (if (< (/ (+ (- (* (* x 9) y) (* (* (* z 4) t) a)) b) (* z c)) -0.0) (/ (/ (+ (- (* (* x 9) y) (* (* (* z 4) t) a)) b) z) c) (if (< (/ (+ (- (* (* x 9) y) (* (* (* z 4) t) a)) b) (* z c)) 1.1708877911747488e-53) (/ (+ (- (* (* x 9) y) (* (* z 4) (* t a))) b) (* z c)) (if (< (/ (+ (- (* (* x 9) y) (* (* (* z 4) t) a)) b) (* z c)) 2.876823679546137e+130) (- (+ (* (* 9 (/ y c)) (/ x z)) (/ b (* c z))) (* 4 (/ (* a t) c))) (if (< (/ (+ (- (* (* x 9) y) (* (* (* z 4) t) a)) b) (* z c)) 1.3838515042456319e+158) (/ (+ (- (* (* x 9) y) (* (* z 4) (* t a))) b) (* z c)) (- (+ (* 9 (* (/ y (* c z)) x)) (/ b (* c z))) (* 4 (/ (* a t) c))))))))
(/ (+ (- (* (* x 9) y) (* (* (* z 4) t) a)) b) (* z c)))