\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b
\begin{array}{l}
t_1 := \left(y \cdot \left(z \cdot t\right)\right) \cdot -9\\
t_2 := \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\\
\mathbf{if}\;t_2 \leq 1.3987757777963822 \cdot 10^{-156}:\\
\;\;\;\;\mathsf{fma}\left(27, a \cdot b, \mathsf{fma}\left(2, x, t_1\right)\right)\\
\mathbf{elif}\;t_2 \leq 6.566185616261638 \cdot 10^{+218}:\\
\;\;\;\;\left(2 \cdot x - t_2\right) + b \cdot \left(27 \cdot a\right)\\
\mathbf{else}:\\
\;\;\;\;t_1 + \left(2 \cdot x + 27 \cdot \left(a \cdot b\right)\right)\\
\end{array}
(FPCore (x y z t a b) :precision binary64 (+ (- (* x 2.0) (* (* (* y 9.0) z) t)) (* (* a 27.0) b)))
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (* y (* z t)) -9.0)) (t_2 (* (* (* y 9.0) z) t)))
(if (<= t_2 1.3987757777963822e-156)
(fma 27.0 (* a b) (fma 2.0 x t_1))
(if (<= t_2 6.566185616261638e+218)
(+ (- (* 2.0 x) t_2) (* b (* 27.0 a)))
(+ t_1 (+ (* 2.0 x) (* 27.0 (* a b))))))))double code(double x, double y, double z, double t, double a, double b) {
return ((x * 2.0) - (((y * 9.0) * z) * t)) + ((a * 27.0) * b);
}
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (y * (z * t)) * -9.0;
double t_2 = ((y * 9.0) * z) * t;
double tmp;
if (t_2 <= 1.3987757777963822e-156) {
tmp = fma(27.0, (a * b), fma(2.0, x, t_1));
} else if (t_2 <= 6.566185616261638e+218) {
tmp = ((2.0 * x) - t_2) + (b * (27.0 * a));
} else {
tmp = t_1 + ((2.0 * x) + (27.0 * (a * b)));
}
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
| Original | 3.1 |
|---|---|
| Target | 3.5 |
| Herbie | 2.2 |
if (*.f64 (*.f64 (*.f64 y 9) z) t) < 1.3987757777963822e-156Initial program 2.5
Simplified2.3
Taylor expanded in y around 0 2.1
Simplified2.1
if 1.3987757777963822e-156 < (*.f64 (*.f64 (*.f64 y 9) z) t) < 6.566185616261638e218Initial program 0.6
if 6.566185616261638e218 < (*.f64 (*.f64 (*.f64 y 9) z) t) Initial program 19.9
Simplified9.2
Taylor expanded in y around 0 9.2
Final simplification2.2
herbie shell --seed 2022067
(FPCore (x y z t a b)
:name "Diagrams.Solve.Polynomial:cubForm from diagrams-solve-0.1, A"
:precision binary64
:herbie-target
(if (< y 7.590524218811189e-161) (+ (- (* x 2.0) (* (* (* y 9.0) z) t)) (* a (* 27.0 b))) (+ (- (* x 2.0) (* 9.0 (* y (* t z)))) (* (* a 27.0) b)))
(+ (- (* x 2.0) (* (* (* y 9.0) z) t)) (* (* a 27.0) b)))