\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}\;y \le -8.36253273616475128 \cdot 10^{-142}:\\
\;\;\;\;\mathsf{fma}\left(-4, \frac{t}{\frac{c}{a}}, \mathsf{fma}\left(9, \frac{1}{\frac{\frac{z \cdot c}{x}}{y}}, \frac{b}{z \cdot c}\right)\right)\\
\mathbf{elif}\;y \le 1.50219372319604604 \cdot 10^{-49}:\\
\;\;\;\;\mathsf{fma}\left(-4, \frac{t \cdot a}{c}, \frac{\frac{\mathsf{fma}\left(9 \cdot x, y, b\right)}{z}}{c}\right)\\
\mathbf{elif}\;y \le 2.4595357268207823 \cdot 10^{133}:\\
\;\;\;\;\mathsf{fma}\left(-4, \frac{a}{\frac{c}{t}}, \frac{\mathsf{fma}\left(x, 9 \cdot y, b\right)}{z \cdot c}\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-4, \frac{t \cdot a}{c}, \mathsf{fma}\left(9, \frac{1}{\frac{\frac{z}{\frac{x}{c}}}{y}}, \frac{b}{z \cdot c}\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 VAR;
if ((y <= -8.362532736164751e-142)) {
VAR = fma(-4.0, (t / (c / a)), fma(9.0, (1.0 / (((z * c) / x) / y)), (b / (z * c))));
} else {
double VAR_1;
if ((y <= 1.502193723196046e-49)) {
VAR_1 = fma(-4.0, ((t * a) / c), ((fma((9.0 * x), y, b) / z) / c));
} else {
double VAR_2;
if ((y <= 2.4595357268207823e+133)) {
VAR_2 = fma(-4.0, (a / (c / t)), (fma(x, (9.0 * y), b) / (z * c)));
} else {
VAR_2 = fma(-4.0, ((t * a) / c), fma(9.0, (1.0 / ((z / (x / c)) / y)), (b / (z * c))));
}
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.7 |
|---|---|
| Target | 14.5 |
| Herbie | 9.4 |
if y < -8.362532736164751e-142Initial program 22.5
Simplified13.7
Taylor expanded around 0 13.5
Simplified13.5
rmApplied *-commutative13.5
Applied associate-/l*11.0
rmApplied clear-num11.0
rmApplied associate-/l*9.3
if -8.362532736164751e-142 < y < 1.502193723196046e-49Initial program 16.9
Simplified7.6
rmApplied associate-/r*7.7
Simplified7.9
if 1.502193723196046e-49 < y < 2.4595357268207823e+133Initial program 20.4
Simplified11.0
rmApplied *-commutative11.0
Applied associate-/l*10.5
if 2.4595357268207823e+133 < y Initial program 28.9
Simplified22.8
Taylor expanded around 0 22.6
Simplified22.6
rmApplied *-commutative22.6
Applied associate-/l*14.8
rmApplied clear-num14.8
rmApplied associate-/l*13.1
Final simplification9.4
herbie shell --seed 2020078 +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)))