\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:\\
\;\;\;\;\left(\frac{b}{z \cdot c} + \frac{y \cdot \left(9 \cdot \frac{x}{z}\right)}{c}\right) - 4 \cdot \left(a \cdot \frac{t}{c}\right)\\
\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 -7.617958998670399 \cdot 10^{+28}:\\
\;\;\;\;\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 4.586261804854663 \cdot 10^{-267}:\\
\;\;\;\;\left(\frac{\left(x \cdot 9\right) \cdot y + b}{z} + a \cdot \left(t \cdot -4\right)\right) \cdot \frac{1}{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.1460816002902752 \cdot 10^{+306}:\\
\;\;\;\;\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}:\\
\;\;\;\;\left(\frac{b}{z \cdot c} + 9 \cdot \left(\frac{x}{z} \cdot \frac{y}{c}\right)\right) - 4 \cdot \left(\sqrt[3]{\frac{t}{c}} \cdot \left(a \cdot \left(\sqrt[3]{\frac{t}{c}} \cdot \sqrt[3]{\frac{t}{c}}\right)\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
(if (<=
(/ (+ (- (* (* x 9.0) y) (* (* (* z 4.0) t) a)) b) (* z c))
(- INFINITY))
(- (+ (/ b (* z c)) (/ (* y (* 9.0 (/ x z))) c)) (* 4.0 (* a (/ t c))))
(if (<=
(/ (+ (- (* (* x 9.0) y) (* (* (* z 4.0) t) a)) b) (* z c))
-7.617958998670399e+28)
(/ (+ (- (* (* 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))
4.586261804854663e-267)
(* (+ (/ (+ (* (* x 9.0) y) b) z) (* a (* t -4.0))) (/ 1.0 c))
(if (<=
(/ (+ (- (* (* x 9.0) y) (* (* (* z 4.0) t) a)) b) (* z c))
1.1460816002902752e+306)
(/ (+ (- (* (* x 9.0) y) (* (* (* z 4.0) t) a)) b) (* z c))
(-
(+ (/ b (* z c)) (* 9.0 (* (/ x z) (/ y c))))
(*
4.0
(* (cbrt (/ t c)) (* a (* (cbrt (/ t c)) (cbrt (/ 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 tmp;
if ((((((x * 9.0) * y) - (((z * 4.0) * t) * a)) + b) / (z * c)) <= -((double) INFINITY)) {
tmp = ((b / (z * c)) + ((y * (9.0 * (x / z))) / c)) - (4.0 * (a * (t / c)));
} else if ((((((x * 9.0) * y) - (((z * 4.0) * t) * a)) + b) / (z * c)) <= -7.617958998670399e+28) {
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)) <= 4.586261804854663e-267) {
tmp = (((((x * 9.0) * y) + b) / z) + (a * (t * -4.0))) * (1.0 / c);
} else if ((((((x * 9.0) * y) - (((z * 4.0) * t) * a)) + b) / (z * c)) <= 1.1460816002902752e+306) {
tmp = ((((x * 9.0) * y) - (((z * 4.0) * t) * a)) + b) / (z * c);
} else {
tmp = ((b / (z * c)) + (9.0 * ((x / z) * (y / c)))) - (4.0 * (cbrt(t / c) * (a * (cbrt(t / c) * cbrt(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
Results
| Original | 20.4 |
|---|---|
| Target | 14.5 |
| Herbie | 4.0 |
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
Simplified27.5
Taylor expanded around 0 32.2
Simplified32.2
rmApplied *-un-lft-identity_binary6432.2
Applied times-frac_binary6429.0
Simplified29.0
rmApplied times-frac_binary6416.8
rmApplied associate-*r/_binary6420.5
Applied associate-*r/_binary6420.5
Simplified20.5
if -inf.0 < (/.f64 (+.f64 (-.f64 (*.f64 (*.f64 x 9) y) (*.f64 (*.f64 (*.f64 z 4) t) a)) b) (*.f64 z c)) < -7.617958998670399e28 or 4.5862618048546627e-267 < (/.f64 (+.f64 (-.f64 (*.f64 (*.f64 x 9) y) (*.f64 (*.f64 (*.f64 z 4) t) a)) b) (*.f64 z c)) < 1.146081600290275e306Initial program 0.7
if -7.617958998670399e28 < (/.f64 (+.f64 (-.f64 (*.f64 (*.f64 x 9) y) (*.f64 (*.f64 (*.f64 z 4) t) a)) b) (*.f64 z c)) < 4.5862618048546627e-267Initial program 17.8
Simplified1.1
rmApplied div-inv_binary641.2
if 1.146081600290275e306 < (/.f64 (+.f64 (-.f64 (*.f64 (*.f64 x 9) y) (*.f64 (*.f64 (*.f64 z 4) t) a)) b) (*.f64 z c)) Initial program 63.4
Simplified26.9
Taylor expanded around 0 30.2
Simplified30.2
rmApplied *-un-lft-identity_binary6430.2
Applied times-frac_binary6424.6
Simplified24.6
rmApplied times-frac_binary6410.2
rmApplied add-cube-cbrt_binary6410.9
Applied associate-*r*_binary6410.9
Final simplification4.0
herbie shell --seed 2020231
(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)))