\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 := \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_1 \leq -\infty:\\
\;\;\;\;\mathsf{fma}\left(t, a \cdot -4, \frac{b}{z}\right) \cdot \frac{1}{c}\\
\mathbf{elif}\;t_1 \leq -9.897613011349107 \cdot 10^{+107}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t_1 \leq 0:\\
\;\;\;\;\frac{\mathsf{fma}\left(9, \frac{x \cdot y}{z}, \frac{b}{z}\right) - 4 \cdot \left(t \cdot a\right)}{c}\\
\mathbf{elif}\;t_1 \leq 3.496187476908017 \cdot 10^{+306}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{c}{\mathsf{fma}\left(t, a \cdot -4, \frac{\mathsf{fma}\left(x, 9 \cdot y, b\right)}{z}\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 (/ (+ (- (* (* x 9.0) y) (* (* (* z 4.0) t) a)) b) (* z c))))
(if (<= t_1 (- INFINITY))
(* (fma t (* a -4.0) (/ b z)) (/ 1.0 c))
(if (<= t_1 -9.897613011349107e+107)
t_1
(if (<= t_1 0.0)
(/ (- (fma 9.0 (/ (* x y) z) (/ b z)) (* 4.0 (* t a))) c)
(if (<= t_1 3.496187476908017e+306)
t_1
(/ 1.0 (/ c (fma t (* a -4.0) (/ (fma x (* 9.0 y) b) z))))))))))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 = ((((x * 9.0) * y) - (((z * 4.0) * t) * a)) + b) / (z * c);
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = fma(t, (a * -4.0), (b / z)) * (1.0 / c);
} else if (t_1 <= -9.897613011349107e+107) {
tmp = t_1;
} else if (t_1 <= 0.0) {
tmp = (fma(9.0, ((x * y) / z), (b / z)) - (4.0 * (t * a))) / c;
} else if (t_1 <= 3.496187476908017e+306) {
tmp = t_1;
} else {
tmp = 1.0 / (c / fma(t, (a * -4.0), (fma(x, (9.0 * y), b) / z)));
}
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.8 |
|---|---|
| Target | 14.9 |
| Herbie | 7.9 |
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
Simplified23.0
Applied div-inv_binary6423.1
Taylor expanded in x around 0 27.8
if -inf.0 < (/.f64 (+.f64 (-.f64 (*.f64 (*.f64 x 9) y) (*.f64 (*.f64 (*.f64 z 4) t) a)) b) (*.f64 z c)) < -9.89761301134910704e107 or 0.0 < (/.f64 (+.f64 (-.f64 (*.f64 (*.f64 x 9) y) (*.f64 (*.f64 (*.f64 z 4) t) a)) b) (*.f64 z c)) < 3.49618747690801697e306Initial program 0.7
if -9.89761301134910704e107 < (/.f64 (+.f64 (-.f64 (*.f64 (*.f64 x 9) y) (*.f64 (*.f64 (*.f64 z 4) t) a)) b) (*.f64 z c)) < 0.0Initial program 14.7
Simplified2.4
Applied clear-num_binary642.8
Taylor expanded in c around 0 2.3
Simplified2.3
if 3.49618747690801697e306 < (/.f64 (+.f64 (-.f64 (*.f64 (*.f64 x 9) y) (*.f64 (*.f64 (*.f64 z 4) t) a)) b) (*.f64 z c)) Initial program 63.6
Simplified26.7
Applied clear-num_binary6426.9
Final simplification7.9
herbie shell --seed 2022096
(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)))