\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}\;\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} \leq -\infty:\\
\;\;\;\;\frac{\frac{\left(x \cdot 9\right) \cdot y + b}{z} + \left(t \cdot a\right) \cdot -4}{c}\\
\mathbf{elif}\;\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} \leq -5.097938307485814 \cdot 10^{+87}:\\
\;\;\;\;\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{elif}\;\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} \leq 5.786019983081405 \cdot 10^{+38}:\\
\;\;\;\;\frac{\left(t \cdot a\right) \cdot -4 + \frac{b + 9 \cdot \left(x \cdot y\right)}{z}}{c}\\
\mathbf{elif}\;\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} \leq 1.9370937598457885 \cdot 10^{+307}:\\
\;\;\;\;\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{else}:\\
\;\;\;\;\frac{1}{c} \cdot \left(\left(t \cdot a\right) \cdot -4 + \frac{b}{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
(if (<=
(/ (+ (- (* (* x 9.0) y) (* (* (* z 4.0) t) a)) b) (* z c))
(- INFINITY))
(/ (+ (/ (+ (* (* x 9.0) y) b) z) (* (* t a) -4.0)) c)
(if (<=
(/ (+ (- (* (* x 9.0) y) (* (* (* z 4.0) t) a)) b) (* z c))
-5.097938307485814e+87)
(/ (+ (- (* (* 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))
5.786019983081405e+38)
(/ (+ (* (* t a) -4.0) (/ (+ b (* 9.0 (* x y))) z)) c)
(if (<=
(/ (+ (- (* (* x 9.0) y) (* (* (* z 4.0) t) a)) b) (* z c))
1.9370937598457885e+307)
(/ (+ (- (* (* x 9.0) y) (* (* (* z 4.0) t) a)) b) (* z c))
(* (/ 1.0 c) (+ (* (* t a) -4.0) (/ 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 tmp;
if ((((((x * 9.0) * y) - (((z * 4.0) * t) * a)) + b) / (z * c)) <= -((double) INFINITY)) {
tmp = (((((x * 9.0) * y) + b) / z) + ((t * a) * -4.0)) / c;
} else if ((((((x * 9.0) * y) - (((z * 4.0) * t) * a)) + b) / (z * c)) <= -5.097938307485814e+87) {
tmp = ((((x * 9.0) * y) - (((z * 4.0) * t) * a)) + b) / (z * c);
} else if ((((((x * 9.0) * y) - (((z * 4.0) * t) * a)) + b) / (z * c)) <= 5.786019983081405e+38) {
tmp = (((t * a) * -4.0) + ((b + (9.0 * (x * y))) / z)) / c;
} else if ((((((x * 9.0) * y) - (((z * 4.0) * t) * a)) + b) / (z * c)) <= 1.9370937598457885e+307) {
tmp = ((((x * 9.0) * y) - (((z * 4.0) * t) * a)) + b) / (z * c);
} else {
tmp = (1.0 / c) * (((t * a) * -4.0) + (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
Results
| Original | 20.4 |
|---|---|
| Target | 14.5 |
| Herbie | 7.4 |
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
Simplified22.5
if -inf.0 < (/.f64 (+.f64 (-.f64 (*.f64 (*.f64 x 9) y) (*.f64 (*.f64 (*.f64 z 4) t) a)) b) (*.f64 z c)) < -5.0979383074858139e87 or 5.78601998308140526e38 < (/.f64 (+.f64 (-.f64 (*.f64 (*.f64 x 9) y) (*.f64 (*.f64 (*.f64 z 4) t) a)) b) (*.f64 z c)) < 1.9370937598457885e307Initial program 0.6
if -5.0979383074858139e87 < (/.f64 (+.f64 (-.f64 (*.f64 (*.f64 x 9) y) (*.f64 (*.f64 (*.f64 z 4) t) a)) b) (*.f64 z c)) < 5.78601998308140526e38Initial program 10.9
Simplified1.7
Taylor expanded around 0 7.1
Simplified1.7
if 1.9370937598457885e307 < (/.f64 (+.f64 (-.f64 (*.f64 (*.f64 x 9) y) (*.f64 (*.f64 (*.f64 z 4) t) a)) b) (*.f64 z c)) Initial program 63.6
Simplified28.0
rmApplied clear-num_binary64_1917328.1
Simplified27.9
rmApplied div-inv_binary64_1917128.0
Applied add-sqr-sqrt_binary64_1919628.0
Applied times-frac_binary64_1918027.9
Simplified27.9
Simplified27.8
Taylor expanded around inf 27.3
Final simplification7.4
herbie shell --seed 2021098
(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.1001567408041051e-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)))