\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}\;z \le -7.31923342190711207 \cdot 10^{-54} \lor \neg \left(z \le 1.7491363804533648 \cdot 10^{-85}\right):\\
\;\;\;\;\mathsf{fma}\left(-4, \frac{t}{c} \cdot a, \frac{\frac{\mathsf{fma}\left(9 \cdot x, y, b\right)}{z}}{c}\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-4, \frac{t}{c} \cdot a, \frac{1}{\frac{z \cdot c}{\mathsf{fma}\left(x, 9 \cdot y, b\right)}}\right)\\
\end{array}double code(double x, double y, double z, double t, double a, double b, double c) {
return (((((x * 9.0) * y) - (((z * 4.0) * t) * a)) + b) / (z * c));
}
double code(double x, double y, double z, double t, double a, double b, double c) {
double temp;
if (((z <= -7.319233421907112e-54) || !(z <= 1.7491363804533648e-85))) {
temp = fma(-4.0, ((t / c) * a), ((fma((9.0 * x), y, b) / z) / c));
} else {
temp = fma(-4.0, ((t / c) * a), (1.0 / ((z * c) / fma(x, (9.0 * y), b))));
}
return temp;
}




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.9 |
| Herbie | 9.6 |
if z < -7.319233421907112e-54 or 1.7491363804533648e-85 < z Initial program 26.6
Simplified13.1
rmApplied associate-/l*13.4
rmApplied associate-/r/13.8
rmApplied associate-/r*10.9
Simplified10.9
if -7.319233421907112e-54 < z < 1.7491363804533648e-85Initial program 6.0
Simplified9.6
rmApplied associate-/l*6.3
rmApplied associate-/r/6.2
rmApplied clear-num6.3
Final simplification9.6
herbie shell --seed 2020057 +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)))