\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{\mathsf{fma}\left(t, a \cdot -4, \frac{\mathsf{fma}\left(x, 9 \cdot y, b\right)}{z}\right)}{c}\\
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:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t_2 \leq -1.1810967417405786 \cdot 10^{-23}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;t_2 \leq 56189.67191339397:\\
\;\;\;\;\mathsf{expm1}\left(\mathsf{log1p}\left(t_1\right)\right)\\
\mathbf{elif}\;t_2 \leq 9.160596822751805 \cdot 10^{+300}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(9, x \cdot \frac{y}{z}, -4 \cdot \left(t \cdot a\right)\right)}{c}\\
\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 t (* a -4.0) (/ (fma x (* 9.0 y) b) z)) c))
(t_2 (/ (+ (- (* (* x 9.0) y) (* (* (* z 4.0) t) a)) b) (* z c))))
(if (<= t_2 (- INFINITY))
t_1
(if (<= t_2 -1.1810967417405786e-23)
t_2
(if (<= t_2 56189.67191339397)
(expm1 (log1p t_1))
(if (<= t_2 9.160596822751805e+300)
t_2
(/ (fma 9.0 (* x (/ y z)) (* -4.0 (* t a))) 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(t, (a * -4.0), (fma(x, (9.0 * y), 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 = t_1;
} else if (t_2 <= -1.1810967417405786e-23) {
tmp = t_2;
} else if (t_2 <= 56189.67191339397) {
tmp = expm1(log1p(t_1));
} else if (t_2 <= 9.160596822751805e+300) {
tmp = t_2;
} else {
tmp = fma(9.0, (x * (y / z)), (-4.0 * (t * a))) / 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.5 |
|---|---|
| Target | 14.5 |
| Herbie | 6.1 |
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.2
Applied div-inv_binary6424.2
Applied associate-*r/_binary6424.2
if -inf.0 < (/.f64 (+.f64 (-.f64 (*.f64 (*.f64 x 9) y) (*.f64 (*.f64 (*.f64 z 4) t) a)) b) (*.f64 z c)) < -1.18109674174057856e-23 or 56189.6719133939696 < (/.f64 (+.f64 (-.f64 (*.f64 (*.f64 x 9) y) (*.f64 (*.f64 (*.f64 z 4) t) a)) b) (*.f64 z c)) < 9.16059682275180511e300Initial program 0.7
if -1.18109674174057856e-23 < (/.f64 (+.f64 (-.f64 (*.f64 (*.f64 x 9) y) (*.f64 (*.f64 (*.f64 z 4) t) a)) b) (*.f64 z c)) < 56189.6719133939696Initial program 14.4
Simplified1.1
Applied expm1-log1p-u_binary641.2
if 9.16059682275180511e300 < (/.f64 (+.f64 (-.f64 (*.f64 (*.f64 x 9) y) (*.f64 (*.f64 (*.f64 z 4) t) a)) b) (*.f64 z c)) Initial program 62.4
Simplified26.9
Applied add-cube-cbrt_binary6427.0
Taylor expanded in b around 0 30.3
Simplified20.4
Final simplification6.1
herbie shell --seed 2022020
(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)))