\left(\left(\left(\left(\left(\left(x \cdot 18\right) \cdot y\right) \cdot z\right) \cdot t - \left(a \cdot 4\right) \cdot t\right) + b \cdot c\right) - \left(x \cdot 4\right) \cdot i\right) - \left(j \cdot 27\right) \cdot k
\begin{array}{l}
\mathbf{if}\;c \leq -1.4189869398597547 \cdot 10^{-103}:\\
\;\;\;\;\mathsf{fma}\left(c, b, \mathsf{fma}\left(-4, \mathsf{fma}\left(t, a, x \cdot i\right), \left(k \cdot j\right) \cdot -27\right)\right)\\
\mathbf{elif}\;c \leq 1.0221135886669087 \cdot 10^{-218}:\\
\;\;\;\;\left(\left(\left(t \cdot \left(\left(x \cdot 18\right) \cdot \left(y \cdot z\right)\right) - t \cdot \left(a \cdot 4\right)\right) + c \cdot b\right) - i \cdot \left(x \cdot 4\right)\right) - k \cdot \left(j \cdot 27\right)\\
\mathbf{else}:\\
\;\;\;\;\begin{array}{l}
t_1 := \mathsf{fma}\left(x, \mathsf{fma}\left(18, y \cdot \left(t \cdot z\right), -4 \cdot i\right), \mathsf{fma}\left(a, -4 \cdot t, \mathsf{fma}\left(-27, k \cdot j, c \cdot b\right)\right)\right)\\
\mathbf{if}\;c \leq 1.133576917693191 \cdot 10^{+145}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\begin{array}{l}
t_2 := -4 \cdot \left(x \cdot i\right)\\
\mathbf{if}\;c \leq 3.0740571289202475 \cdot 10^{+231}:\\
\;\;\;\;\mathsf{fma}\left(c, b, \mathsf{fma}\left(t, \mathsf{fma}\left(y, 18 \cdot \left(x \cdot z\right), -4 \cdot a\right), \mathsf{fma}\left(k \cdot j, -27, t_2\right)\right)\right)\\
\mathbf{elif}\;c \leq 5.4509450614732235 \cdot 10^{+258}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t, \mathsf{fma}\left(18, y \cdot \left(x \cdot z\right), -4 \cdot a\right), \mathsf{fma}\left(c, b, t_2\right)\right)\\
\end{array}\\
\end{array}\\
\end{array}
(FPCore (x y z t a b c i j k) :precision binary64 (- (- (+ (- (* (* (* (* x 18.0) y) z) t) (* (* a 4.0) t)) (* b c)) (* (* x 4.0) i)) (* (* j 27.0) k)))
(FPCore (x y z t a b c i j k)
:precision binary64
(if (<= c -1.4189869398597547e-103)
(fma c b (fma -4.0 (fma t a (* x i)) (* (* k j) -27.0)))
(if (<= c 1.0221135886669087e-218)
(-
(-
(+ (- (* t (* (* x 18.0) (* y z))) (* t (* a 4.0))) (* c b))
(* i (* x 4.0)))
(* k (* j 27.0)))
(let* ((t_1
(fma
x
(fma 18.0 (* y (* t z)) (* -4.0 i))
(fma a (* -4.0 t) (fma -27.0 (* k j) (* c b))))))
(if (<= c 1.133576917693191e+145)
t_1
(let* ((t_2 (* -4.0 (* x i))))
(if (<= c 3.0740571289202475e+231)
(fma
c
b
(fma
t
(fma y (* 18.0 (* x z)) (* -4.0 a))
(fma (* k j) -27.0 t_2)))
(if (<= c 5.4509450614732235e+258)
t_1
(fma
t
(fma 18.0 (* y (* x z)) (* -4.0 a))
(fma c b t_2))))))))))double code(double x, double y, double z, double t, double a, double b, double c, double i, double j, double k) {
return (((((((x * 18.0) * y) * z) * t) - ((a * 4.0) * t)) + (b * c)) - ((x * 4.0) * i)) - ((j * 27.0) * k);
}
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j, double k) {
double tmp;
if (c <= -1.4189869398597547e-103) {
tmp = fma(c, b, fma(-4.0, fma(t, a, (x * i)), ((k * j) * -27.0)));
} else if (c <= 1.0221135886669087e-218) {
tmp = ((((t * ((x * 18.0) * (y * z))) - (t * (a * 4.0))) + (c * b)) - (i * (x * 4.0))) - (k * (j * 27.0));
} else {
double t_1 = fma(x, fma(18.0, (y * (t * z)), (-4.0 * i)), fma(a, (-4.0 * t), fma(-27.0, (k * j), (c * b))));
double tmp_1;
if (c <= 1.133576917693191e+145) {
tmp_1 = t_1;
} else {
double t_2 = -4.0 * (x * i);
double tmp_2;
if (c <= 3.0740571289202475e+231) {
tmp_2 = fma(c, b, fma(t, fma(y, (18.0 * (x * z)), (-4.0 * a)), fma((k * j), -27.0, t_2)));
} else if (c <= 5.4509450614732235e+258) {
tmp_2 = t_1;
} else {
tmp_2 = fma(t, fma(18.0, (y * (x * z)), (-4.0 * a)), fma(c, b, t_2));
}
tmp_1 = tmp_2;
}
tmp = tmp_1;
}
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




Bits error versus i




Bits error versus j




Bits error versus k
| Original | 9.1 |
|---|---|
| Target | 6.6 |
| Herbie | 8.0 |
if c < -1.4189869398597547e-103Initial program 10.2
Simplified7.0
Taylor expanded in y around 0 13.4
Simplified12.0
if -1.4189869398597547e-103 < c < 1.02211358866690874e-218Initial program 7.8
Applied associate-*l*_binary648.2
if 1.02211358866690874e-218 < c < 1.13357691769319104e145 or 3.0740571289202475e231 < c < 5.4509450614732235e258Initial program 8.6
Simplified6.5
Applied associate-*r*_binary646.8
Applied pow1_binary646.8
Applied pow1_binary646.8
Applied pow1_binary646.8
Applied pow-prod-down_binary646.8
Applied pow-prod-down_binary646.8
Simplified6.5
if 1.13357691769319104e145 < c < 3.0740571289202475e231Initial program 9.2
Simplified6.6
Taylor expanded in x around 0 8.8
Simplified6.2
if 5.4509450614732235e258 < c Initial program 13.5
Taylor expanded in j around 0 16.4
Simplified13.4
Final simplification8.0
herbie shell --seed 2022068
(FPCore (x y z t a b c i j k)
:name "Diagrams.Solve.Polynomial:cubForm from diagrams-solve-0.1, E"
:precision binary64
:herbie-target
(if (< t -1.6210815397541398e-69) (- (- (* (* 18.0 t) (* (* x y) z)) (* (+ (* a t) (* i x)) 4.0)) (- (* (* k j) 27.0) (* c b))) (if (< t 165.68027943805222) (+ (- (* (* 18.0 y) (* x (* z t))) (* (+ (* a t) (* i x)) 4.0)) (- (* c b) (* 27.0 (* k j)))) (- (- (* (* 18.0 t) (* (* x y) z)) (* (+ (* a t) (* i x)) 4.0)) (- (* (* k j) 27.0) (* c b)))))
(- (- (+ (- (* (* (* (* x 18.0) y) z) t) (* (* a 4.0) t)) (* b c)) (* (* x 4.0) i)) (* (* j 27.0) k)))