\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}
t_1 := \mathsf{fma}\left(\frac{y}{c}, \frac{x}{z}, 0.1111111111111111 \cdot \frac{b}{z \cdot c}\right)\\
t_2 := \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{if}\;t_2 \leq -\infty:\\
\;\;\;\;\mathsf{fma}\left(\sqrt[3]{729}, t_1, \frac{a}{\frac{c}{t}} \cdot -4\right)\\
\mathbf{elif}\;t_2 \leq -5266711554336.997:\\
\;\;\;\;t_2\\
\mathbf{elif}\;t_2 \leq 0:\\
\;\;\;\;\frac{\mathsf{fma}\left(t, a \cdot -4, \frac{\mathsf{fma}\left(x, 9 \cdot y, b\right)}{z}\right)}{c}\\
\mathbf{elif}\;t_2 \leq 1.3778404511985451 \cdot 10^{+290}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\sqrt[3]{729}, t_1, -4 \cdot \left(a \cdot \frac{t}{c}\right)\right)\\
\end{array}
(FPCore (x y z t a b c) :precision binary64 (/ (+ (- (* (* x 9.0) y) (* (* (* z 4.0) t) a)) b) (* z c)))
(FPCore (x y z t a b c)
:precision binary64
(let* ((t_1 (fma (/ y c) (/ x z) (* 0.1111111111111111 (/ b (* z c)))))
(t_2 (/ (+ (- (* (* x 9.0) y) (* (* (* z 4.0) t) a)) b) (* z c))))
(if (<= t_2 (- INFINITY))
(fma (cbrt 729.0) t_1 (* (/ a (/ c t)) -4.0))
(if (<= t_2 -5266711554336.997)
t_2
(if (<= t_2 0.0)
(/ (fma t (* a -4.0) (/ (fma x (* 9.0 y) b) z)) c)
(if (<= t_2 1.3778404511985451e+290)
t_2
(fma (cbrt 729.0) t_1 (* -4.0 (* a (/ t c))))))))))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 t_1 = fma((y / c), (x / z), (0.1111111111111111 * (b / (z * c))));
double t_2 = ((((x * 9.0) * y) - (((z * 4.0) * t) * a)) + b) / (z * c);
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = fma(cbrt(729.0), t_1, ((a / (c / t)) * -4.0));
} else if (t_2 <= -5266711554336.997) {
tmp = t_2;
} else if (t_2 <= 0.0) {
tmp = fma(t, (a * -4.0), (fma(x, (9.0 * y), b) / z)) / c;
} else if (t_2 <= 1.3778404511985451e+290) {
tmp = t_2;
} else {
tmp = fma(cbrt(729.0), t_1, (-4.0 * (a * (t / c))));
}
return tmp;
}




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
| Original | 20.6 |
|---|---|
| Target | 14.4 |
| Herbie | 3.8 |
if (/.f64 (+.f64 (-.f64 (*.f64 (*.f64 x 9) y) (*.f64 (*.f64 (*.f64 z 4) t) a)) b) (*.f64 z c)) < -inf.0Initial program 64.0
Simplified24.6
Applied div-inv_binary6424.7
Applied add-cube-cbrt_binary6424.8
Applied associate-/l*_binary6424.8
Simplified24.8
Taylor expanded in b around 0 30.2
Simplified19.5
Applied associate-/l*_binary6416.5
if -inf.0 < (/.f64 (+.f64 (-.f64 (*.f64 (*.f64 x 9) y) (*.f64 (*.f64 (*.f64 z 4) t) a)) b) (*.f64 z c)) < -5266711554336.99707 or -0.0 < (/.f64 (+.f64 (-.f64 (*.f64 (*.f64 x 9) y) (*.f64 (*.f64 (*.f64 z 4) t) a)) b) (*.f64 z c)) < 1.37784045119854511e290Initial program 0.7
if -5266711554336.99707 < (/.f64 (+.f64 (-.f64 (*.f64 (*.f64 x 9) y) (*.f64 (*.f64 (*.f64 z 4) t) a)) b) (*.f64 z c)) < -0.0Initial program 20.0
Simplified1.0
if 1.37784045119854511e290 < (/.f64 (+.f64 (-.f64 (*.f64 (*.f64 x 9) y) (*.f64 (*.f64 (*.f64 z 4) t) a)) b) (*.f64 z c)) Initial program 60.4
Simplified26.8
Applied div-inv_binary6426.9
Applied add-cube-cbrt_binary6427.0
Applied associate-/l*_binary6427.0
Simplified27.0
Taylor expanded in b around 0 29.5
Simplified17.8
Applied *-un-lft-identity_binary6417.8
Applied times-frac_binary6410.9
Simplified10.9
Final simplification3.8
herbie shell --seed 2022125
(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.100156740804105e-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)))