\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:\\
\;\;\;\;\frac{\mathsf{fma}\left(t, a \cdot -4, \frac{1}{\frac{z}{b}}\right)}{c}\\
\mathbf{elif}\;t_1 \leq -3.1827810422849484 \cdot 10^{-118}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t_1 \leq 1.8127021265376826 \cdot 10^{-70}:\\
\;\;\;\;\frac{\mathsf{fma}\left(a, t \cdot -4, \frac{\mathsf{fma}\left(9, x \cdot y, b\right)}{z}\right)}{c}\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{b}{z \cdot c} + 9 \cdot \frac{x \cdot y}{z \cdot c}\right) - 4 \cdot \frac{t \cdot a}{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 (/ (+ (- (* (* x 9.0) y) (* (* (* z 4.0) t) a)) b) (* z c))))
(if (<= t_1 (- INFINITY))
(/ (fma t (* a -4.0) (/ 1.0 (/ z b))) c)
(if (<= t_1 -3.1827810422849484e-118)
t_1
(if (<= t_1 1.8127021265376826e-70)
(/ (fma a (* t -4.0) (/ (fma 9.0 (* x y) b) z)) c)
(-
(+ (/ b (* z c)) (* 9.0 (/ (* x y) (* z c))))
(* 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 = ((((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), (1.0 / (z / b))) / c;
} else if (t_1 <= -3.1827810422849484e-118) {
tmp = t_1;
} else if (t_1 <= 1.8127021265376826e-70) {
tmp = fma(a, (t * -4.0), (fma(9.0, (x * y), b) / z)) / c;
} else {
tmp = ((b / (z * c)) + (9.0 * ((x * y) / (z * c)))) - (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.6 |
|---|---|
| Target | 14.4 |
| Herbie | 8.7 |
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.1
Applied clear-num_binary6424.2
Simplified24.1
Taylor expanded in y around 0 26.9
if -inf.0 < (/.f64 (+.f64 (-.f64 (*.f64 (*.f64 x 9) y) (*.f64 (*.f64 (*.f64 z 4) t) a)) b) (*.f64 z c)) < -3.18278104228494836e-118Initial program 0.8
if -3.18278104228494836e-118 < (/.f64 (+.f64 (-.f64 (*.f64 (*.f64 x 9) y) (*.f64 (*.f64 (*.f64 z 4) t) a)) b) (*.f64 z c)) < 1.81270212653768255e-70Initial program 20.1
Simplified1.3
Taylor expanded in t around 0 13.0
Simplified1.2
if 1.81270212653768255e-70 < (/.f64 (+.f64 (-.f64 (*.f64 (*.f64 x 9) y) (*.f64 (*.f64 (*.f64 z 4) t) a)) b) (*.f64 z c)) Initial program 26.3
Simplified17.6
Taylor expanded in t around 0 14.1
Final simplification8.7
herbie shell --seed 2022066
(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)))