\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}\;c \le -2.40571448827971033 \cdot 10^{26} \lor \neg \left(c \le 1.05955598498016459 \cdot 10^{-12}\right):\\
\;\;\;\;\mathsf{fma}\left(-4, \frac{a}{\frac{c}{t}}, \frac{\mathsf{fma}\left(9, \frac{y}{\frac{c}{x}}, \frac{b}{c}\right)}{z}\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-4, \frac{t \cdot 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 (((((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 (((c <= -2.4057144882797103e+26) || !(c <= 1.0595559849801646e-12))) {
VAR = fma(-4.0, (a / (c / t)), (fma(9.0, (y / (c / x)), (b / c)) / z));
} else {
VAR = fma(-4.0, ((t * a) / c), ((fma((9.0 * x), y, b) / z) / c));
}
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.4 |
|---|---|
| Target | 14.2 |
| Herbie | 5.0 |
if c < -2.4057144882797103e+26 or 1.0595559849801646e-12 < c Initial program 23.4
Simplified15.0
rmApplied *-commutative15.0
Applied associate-/l*11.6
rmApplied *-commutative11.6
Applied associate-/r*8.9
Simplified8.9
Taylor expanded around 0 8.7
Simplified8.7
rmApplied *-commutative8.7
Applied associate-/l*6.1
if -2.4057144882797103e+26 < c < 1.0595559849801646e-12Initial program 14.4
Simplified5.2
rmApplied associate-/r*2.9
Simplified2.9
Final simplification5.0
herbie shell --seed 2020071 +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)))