\left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - t \cdot i\right)\right) + j \cdot \left(c \cdot a - y \cdot i\right)
\begin{array}{l}
t_1 := c \cdot \left(a \cdot j - b \cdot z\right)\\
t_2 := i \cdot b - a \cdot x\\
\mathbf{if}\;y \leq -3.4146347982611155 \cdot 10^{+236}:\\
\;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(\mathsf{fma}\left(t, t_2, t_1\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\begin{array}{l}
t_3 := y \cdot \left(x \cdot z\right)\\
t_4 := y \cdot \left(i \cdot j\right)\\
\mathbf{if}\;y \leq -5.583327439550542 \cdot 10^{+166}:\\
\;\;\;\;\left(i \cdot \left(t \cdot b\right) + t_3\right) - \left(t_4 + a \cdot \left(t \cdot x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\begin{array}{l}
t_5 := c \cdot \left(b \cdot z\right)\\
\mathbf{if}\;y \leq -6.587183720127357 \cdot 10^{+113}:\\
\;\;\;\;\left(t_3 + c \cdot \left(a \cdot j\right)\right) - \left(t_4 + t_5\right)\\
\mathbf{else}:\\
\;\;\;\;\begin{array}{l}
t_6 := y \cdot z - t \cdot a\\
\mathbf{if}\;y \leq -746741518026.9556:\\
\;\;\;\;x \cdot t_6 + i \cdot \left(t \cdot b - y \cdot j\right)\\
\mathbf{else}:\\
\;\;\;\;\begin{array}{l}
t_7 := j \cdot \left(a \cdot c - y \cdot i\right)\\
\mathbf{if}\;y \leq -5.418483375313162 \cdot 10^{-135}:\\
\;\;\;\;\mathsf{fma}\left(x, t_6, t_7\right) - t_5\\
\mathbf{elif}\;y \leq 3.5212638255044147 \cdot 10^{-245}:\\
\;\;\;\;b \cdot \left(t \cdot i\right) + \left(a \cdot \left(c \cdot j - t \cdot x\right) - b \cdot \left(c \cdot z\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\begin{array}{l}
t_8 := t \cdot i - c \cdot z\\
\mathbf{if}\;y \leq 1.0736222073065391 \cdot 10^{-79}:\\
\;\;\;\;\mathsf{fma}\left(b, t_8, \mathsf{fma}\left(x, \mathsf{fma}\left(y, z, -t \cdot a\right), t_7\right)\right)\\
\mathbf{elif}\;y \leq 1.4276677929317117 \cdot 10^{-52}:\\
\;\;\;\;t_1 + t \cdot \mathsf{log1p}\left(\mathsf{expm1}\left(t_2\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(b, t_8, \mathsf{fma}\left(x, t_6, -t_4\right)\right)\\
\end{array}\\
\end{array}\\
\end{array}\\
\end{array}\\
\end{array}\\
\end{array}
(FPCore (x y z t a b c i j) :precision binary64 (+ (- (* x (- (* y z) (* t a))) (* b (- (* c z) (* t i)))) (* j (- (* c a) (* y i)))))
(FPCore (x y z t a b c i j)
:precision binary64
(let* ((t_1 (* c (- (* a j) (* b z)))) (t_2 (- (* i b) (* a x))))
(if (<= y -3.4146347982611155e+236)
(log1p (expm1 (fma t t_2 t_1)))
(let* ((t_3 (* y (* x z))) (t_4 (* y (* i j))))
(if (<= y -5.583327439550542e+166)
(- (+ (* i (* t b)) t_3) (+ t_4 (* a (* t x))))
(let* ((t_5 (* c (* b z))))
(if (<= y -6.587183720127357e+113)
(- (+ t_3 (* c (* a j))) (+ t_4 t_5))
(let* ((t_6 (- (* y z) (* t a))))
(if (<= y -746741518026.9556)
(+ (* x t_6) (* i (- (* t b) (* y j))))
(let* ((t_7 (* j (- (* a c) (* y i)))))
(if (<= y -5.418483375313162e-135)
(- (fma x t_6 t_7) t_5)
(if (<= y 3.5212638255044147e-245)
(+
(* b (* t i))
(- (* a (- (* c j) (* t x))) (* b (* c z))))
(let* ((t_8 (- (* t i) (* c z))))
(if (<= y 1.0736222073065391e-79)
(fma b t_8 (fma x (fma y z (- (* t a))) t_7))
(if (<= y 1.4276677929317117e-52)
(+ t_1 (* t (log1p (expm1 t_2))))
(fma b t_8 (fma x t_6 (- t_4))))))))))))))))))double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
return ((x * ((y * z) - (t * a))) - (b * ((c * z) - (t * i)))) + (j * ((c * a) - (y * i)));
}
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double t_1 = c * ((a * j) - (b * z));
double t_2 = (i * b) - (a * x);
double tmp;
if (y <= -3.4146347982611155e+236) {
tmp = log1p(expm1(fma(t, t_2, t_1)));
} else {
double t_3 = y * (x * z);
double t_4 = y * (i * j);
double tmp_1;
if (y <= -5.583327439550542e+166) {
tmp_1 = ((i * (t * b)) + t_3) - (t_4 + (a * (t * x)));
} else {
double t_5 = c * (b * z);
double tmp_2;
if (y <= -6.587183720127357e+113) {
tmp_2 = (t_3 + (c * (a * j))) - (t_4 + t_5);
} else {
double t_6 = (y * z) - (t * a);
double tmp_3;
if (y <= -746741518026.9556) {
tmp_3 = (x * t_6) + (i * ((t * b) - (y * j)));
} else {
double t_7 = j * ((a * c) - (y * i));
double tmp_4;
if (y <= -5.418483375313162e-135) {
tmp_4 = fma(x, t_6, t_7) - t_5;
} else if (y <= 3.5212638255044147e-245) {
tmp_4 = (b * (t * i)) + ((a * ((c * j) - (t * x))) - (b * (c * z)));
} else {
double t_8 = (t * i) - (c * z);
double tmp_5;
if (y <= 1.0736222073065391e-79) {
tmp_5 = fma(b, t_8, fma(x, fma(y, z, -(t * a)), t_7));
} else if (y <= 1.4276677929317117e-52) {
tmp_5 = t_1 + (t * log1p(expm1(t_2)));
} else {
tmp_5 = fma(b, t_8, fma(x, t_6, -t_4));
}
tmp_4 = tmp_5;
}
tmp_3 = tmp_4;
}
tmp_2 = tmp_3;
}
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
| Original | 16.9 |
|---|---|
| Target | 25.9 |
| Herbie | 19.1 |
if y < -3.4146347982611155e236Initial program 27.3
Simplified24.4
Taylor expanded in y around 0 42.5
Simplified39.2
Applied log1p-expm1-u_binary6436.3
Simplified35.5
if -3.4146347982611155e236 < y < -5.5833274395505421e166Initial program 23.7
Simplified20.9
Taylor expanded in c around 0 22.2
if -5.5833274395505421e166 < y < -6.58718372012735694e113Initial program 19.1
Simplified16.2
Taylor expanded in t around 0 19.7
if -6.58718372012735694e113 < y < -746741518026.95557Initial program 15.3
Simplified13.7
Taylor expanded in c around 0 23.6
Simplified21.4
if -746741518026.95557 < y < -5.418483375313162e-135Initial program 11.8
Simplified10.7
Applied fma-udef_binary6411.0
Taylor expanded in z around inf 18.2
if -5.418483375313162e-135 < y < 3.52126382550441473e-245Initial program 11.9
Simplified11.0
Applied fma-udef_binary6411.6
Applied sub-neg_binary6411.6
Applied distribute-rgt-in_binary6412.3
Applied associate-+l+_binary6412.3
Simplified12.3
Taylor expanded in y around 0 16.8
Simplified15.5
if 3.52126382550441473e-245 < y < 1.07362220730653913e-79Initial program 14.0
Simplified13.1
Applied fma-neg_binary6413.1
Simplified13.1
if 1.07362220730653913e-79 < y < 1.4276677929317117e-52Initial program 14.1
Simplified11.6
Taylor expanded in y around 0 23.4
Simplified22.8
Applied log1p-expm1-u_binary6430.6
if 1.4276677929317117e-52 < y Initial program 20.3
Simplified17.9
Taylor expanded in a around 0 18.8
Final simplification19.1
herbie shell --seed 2022088
(FPCore (x y z t a b c i j)
:name "Data.Colour.Matrix:determinant from colour-2.3.3, A"
:precision binary64
:herbie-target
(if (< x -1.469694296777705e-64) (+ (- (* x (- (* y z) (* t a))) (/ (* b (- (pow (* c z) 2.0) (pow (* t i) 2.0))) (+ (* c z) (* t i)))) (* j (- (* c a) (* y i)))) (if (< x 3.2113527362226803e-147) (- (* (- (* b i) (* x a)) t) (- (* z (* c b)) (* j (- (* c a) (* y i))))) (+ (- (* x (- (* y z) (* t a))) (/ (* b (- (pow (* c z) 2.0) (pow (* t i) 2.0))) (+ (* c z) (* t i)))) (* j (- (* c a) (* y i))))))
(+ (- (* x (- (* y z) (* t a))) (* b (- (* c z) (* t i)))) (* j (- (* c a) (* y i)))))