\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}\\
t_2 := \frac{b}{z \cdot c} + 9 \cdot \left(x \cdot \frac{y}{z \cdot c}\right)\\
\mathbf{if}\;t_1 \leq -2.506799129751473 \cdot 10^{+296}:\\
\;\;\;\;t_2 - 4 \cdot \left(t \cdot \frac{a}{c}\right)\\
\mathbf{elif}\;t_1 \leq -2.7059960238915596 \cdot 10^{-120}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t_1 \leq 2.0827540131780558 \cdot 10^{+51}:\\
\;\;\;\;\frac{\mathsf{fma}\left(t, a \cdot -4, \frac{b + x \cdot \left(9 \cdot y\right)}{z}\right)}{c}\\
\mathbf{else}:\\
\;\;\;\;t_2 - 4 \cdot \frac{a}{\frac{c}{t}}\\
\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)))
(t_2 (+ (/ b (* z c)) (* 9.0 (* x (/ y (* z c)))))))
(if (<= t_1 -2.506799129751473e+296)
(- t_2 (* 4.0 (* t (/ a c))))
(if (<= t_1 -2.7059960238915596e-120)
t_1
(if (<= t_1 2.0827540131780558e+51)
(/ (fma t (* a -4.0) (/ (+ b (* x (* 9.0 y))) z)) c)
(- t_2 (* 4.0 (/ a (/ c t)))))))))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 t_2 = (b / (z * c)) + (9.0 * (x * (y / (z * c))));
double tmp;
if (t_1 <= -2.506799129751473e+296) {
tmp = t_2 - (4.0 * (t * (a / c)));
} else if (t_1 <= -2.7059960238915596e-120) {
tmp = t_1;
} else if (t_1 <= 2.0827540131780558e+51) {
tmp = fma(t, (a * -4.0), ((b + (x * (9.0 * y))) / z)) / c;
} else {
tmp = t_2 - (4.0 * (a / (c / t)));
}
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 | 21.2 |
|---|---|
| Target | 14.8 |
| Herbie | 4.9 |
if (/.f64 (+.f64 (-.f64 (*.f64 (*.f64 x 9) y) (*.f64 (*.f64 (*.f64 z 4) t) a)) b) (*.f64 z c)) < -2.50679912975147289e296Initial program 57.7
Simplified23.7
Taylor expanded in t around 0 27.3
Applied egg-rr15.8
Applied egg-rr9.2
if -2.50679912975147289e296 < (/.f64 (+.f64 (-.f64 (*.f64 (*.f64 x 9) y) (*.f64 (*.f64 (*.f64 z 4) t) a)) b) (*.f64 z c)) < -2.70599602389155958e-120Initial program 0.7
if -2.70599602389155958e-120 < (/.f64 (+.f64 (-.f64 (*.f64 (*.f64 x 9) y) (*.f64 (*.f64 (*.f64 z 4) t) a)) b) (*.f64 z c)) < 2.08275401317805579e51Initial program 15.4
Simplified1.2
Applied egg-rr1.2
if 2.08275401317805579e51 < (/.f64 (+.f64 (-.f64 (*.f64 (*.f64 x 9) y) (*.f64 (*.f64 (*.f64 z 4) t) a)) b) (*.f64 z c)) Initial program 32.5
Simplified21.3
Taylor expanded in t around 0 17.1
Applied egg-rr14.5
Applied egg-rr10.9
Applied egg-rr9.9
Final simplification4.9
herbie shell --seed 2022130
(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)))