\[\left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - i \cdot a\right)\right) + j \cdot \left(c \cdot t - i \cdot y\right)
\]
↓
\[\begin{array}{l}
t_1 := a \cdot i - z \cdot c\\
t_2 := \mathsf{fma}\left(t_1, b, b \cdot \left(z \cdot c - a \cdot i\right)\right)\\
t_3 := y \cdot z - t \cdot a\\
t_4 := j \cdot \left(t \cdot c - y \cdot i\right)\\
t_5 := b \cdot t_1\\
t_6 := t_4 + \left(x \cdot t_3 + t_5\right)\\
\mathbf{if}\;t_6 \leq -1 \cdot 10^{+301} \lor \neg \left(t_6 \leq 10^{+308}\right):\\
\;\;\;\;\left(\left(c \cdot \left(t \cdot j\right) + y \cdot \left(x \cdot z\right)\right) + i \cdot \left(a \cdot b - y \cdot j\right)\right) - c \cdot \left(z \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\mathsf{fma}\left(x, t_3, t_5\right) + \left(t_2 + t_2\right)\right) + t_4\\
\end{array}
\]
(FPCore (x y z t a b c i j)
:precision binary64
(+
(- (* x (- (* y z) (* t a))) (* b (- (* c z) (* i a))))
(* j (- (* c t) (* i y)))))
↓
(FPCore (x y z t a b c i j)
:precision binary64
(let* ((t_1 (- (* a i) (* z c)))
(t_2 (fma t_1 b (* b (- (* z c) (* a i)))))
(t_3 (- (* y z) (* t a)))
(t_4 (* j (- (* t c) (* y i))))
(t_5 (* b t_1))
(t_6 (+ t_4 (+ (* x t_3) t_5))))
(if (or (<= t_6 -1e+301) (not (<= t_6 1e+308)))
(-
(+ (+ (* c (* t j)) (* y (* x z))) (* i (- (* a b) (* y j))))
(* c (* z b)))
(+ (+ (fma x t_3 t_5) (+ t_2 t_2)) t_4))))
if (+.f64 (-.f64 (*.f64 x (-.f64 (*.f64 y z) (*.f64 t a))) (*.f64 b (-.f64 (*.f64 c z) (*.f64 i a)))) (*.f64 j (-.f64 (*.f64 c t) (*.f64 i y)))) < -1.00000000000000005e301 or 1e308 < (+.f64 (-.f64 (*.f64 x (-.f64 (*.f64 y z) (*.f64 t a))) (*.f64 b (-.f64 (*.f64 c z) (*.f64 i a)))) (*.f64 j (-.f64 (*.f64 c t) (*.f64 i y))))
Initial program 6.1%
\[\left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - i \cdot a\right)\right) + j \cdot \left(c \cdot t - i \cdot y\right)
\]
Simplified6.1%
\[\leadsto \color{blue}{\mathsf{fma}\left(j, t \cdot c - y \cdot i, x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(z \cdot c - a \cdot i\right)\right)}
\]
Proof
[Start]6.1
\[ \left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - i \cdot a\right)\right) + j \cdot \left(c \cdot t - i \cdot y\right)
\]
+-commutative [=>]6.1
\[ \color{blue}{j \cdot \left(c \cdot t - i \cdot y\right) + \left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - i \cdot a\right)\right)}
\]
fma-def [=>]6.1
\[ \color{blue}{\mathsf{fma}\left(j, c \cdot t - i \cdot y, x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - i \cdot a\right)\right)}
\]
*-commutative [=>]6.1
\[ \mathsf{fma}\left(j, c \cdot t - \color{blue}{y \cdot i}, x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - i \cdot a\right)\right)
\]
*-commutative [=>]6.1
\[ \mathsf{fma}\left(j, \color{blue}{t \cdot c} - y \cdot i, x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - i \cdot a\right)\right)
\]
*-commutative [=>]6.1
\[ \mathsf{fma}\left(j, t \cdot c - y \cdot i, x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - \color{blue}{a \cdot i}\right)\right)
\]
*-commutative [=>]6.1
\[ \mathsf{fma}\left(j, t \cdot c - y \cdot i, x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(\color{blue}{z \cdot c} - a \cdot i\right)\right)
\]
Taylor expanded in i around -inf 63.4%
\[\leadsto \color{blue}{\left(-1 \cdot \left(i \cdot \left(y \cdot j - a \cdot b\right)\right) + \left(c \cdot \left(t \cdot j\right) + \left(y \cdot z - a \cdot t\right) \cdot x\right)\right) - c \cdot \left(b \cdot z\right)}
\]
if -1.00000000000000005e301 < (+.f64 (-.f64 (*.f64 x (-.f64 (*.f64 y z) (*.f64 t a))) (*.f64 b (-.f64 (*.f64 c z) (*.f64 i a)))) (*.f64 j (-.f64 (*.f64 c t) (*.f64 i y)))) < 1e308
Initial program 98.9%
\[\left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - i \cdot a\right)\right) + j \cdot \left(c \cdot t - i \cdot y\right)
\]
Simplified98.9%
\[\leadsto \color{blue}{\left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(z \cdot c - a \cdot i\right)\right) + j \cdot \left(t \cdot c - y \cdot i\right)}
\]
Proof
[Start]98.9
\[ \left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - i \cdot a\right)\right) + j \cdot \left(c \cdot t - i \cdot y\right)
\]
cancel-sign-sub [<=]98.9
\[ \color{blue}{\left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - i \cdot a\right)\right) - \left(-j\right) \cdot \left(c \cdot t - i \cdot y\right)}
\]
cancel-sign-sub-inv [=>]98.9
\[ \color{blue}{\left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - i \cdot a\right)\right) + \left(-\left(-j\right)\right) \cdot \left(c \cdot t - i \cdot y\right)}
\]
*-commutative [=>]98.9
\[ \left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - \color{blue}{a \cdot i}\right)\right) + \left(-\left(-j\right)\right) \cdot \left(c \cdot t - i \cdot y\right)
\]
*-commutative [=>]98.9
\[ \left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(\color{blue}{z \cdot c} - a \cdot i\right)\right) + \left(-\left(-j\right)\right) \cdot \left(c \cdot t - i \cdot y\right)
\]
remove-double-neg [=>]98.9
\[ \left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(z \cdot c - a \cdot i\right)\right) + \color{blue}{j} \cdot \left(c \cdot t - i \cdot y\right)
\]
*-commutative [=>]98.9
\[ \left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(z \cdot c - a \cdot i\right)\right) + j \cdot \left(\color{blue}{t \cdot c} - i \cdot y\right)
\]
*-commutative [=>]98.9
\[ \left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(z \cdot c - a \cdot i\right)\right) + j \cdot \left(t \cdot c - \color{blue}{y \cdot i}\right)
\]
Applied egg-rr98.8%
\[\leadsto \color{blue}{\left(\mathsf{fma}\left(x, y \cdot z - t \cdot a, \left(c \cdot z - i \cdot a\right) \cdot \left(-b\right)\right) + \left(\mathsf{fma}\left(-\left(c \cdot z - i \cdot a\right), b, b \cdot \left(c \cdot z - i \cdot a\right)\right) + \mathsf{fma}\left(-\left(c \cdot z - i \cdot a\right), b, b \cdot \left(c \cdot z - i \cdot a\right)\right)\right)\right)} + j \cdot \left(t \cdot c - y \cdot i\right)
\]
Proof
[Start]98.9
\[ \left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(z \cdot c - a \cdot i\right)\right) + j \cdot \left(t \cdot c - y \cdot i\right)
\]
prod-diff [=>]98.9
\[ \color{blue}{\left(\mathsf{fma}\left(x, y \cdot z - t \cdot a, -\left(z \cdot c - a \cdot i\right) \cdot b\right) + \mathsf{fma}\left(-\left(z \cdot c - a \cdot i\right), b, \left(z \cdot c - a \cdot i\right) \cdot b\right)\right)} + j \cdot \left(t \cdot c - y \cdot i\right)
\]
*-commutative [<=]98.9
\[ \left(\mathsf{fma}\left(x, y \cdot z - t \cdot a, -\color{blue}{b \cdot \left(z \cdot c - a \cdot i\right)}\right) + \mathsf{fma}\left(-\left(z \cdot c - a \cdot i\right), b, \left(z \cdot c - a \cdot i\right) \cdot b\right)\right) + j \cdot \left(t \cdot c - y \cdot i\right)
\]
fma-neg [<=]98.9
\[ \left(\color{blue}{\left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(z \cdot c - a \cdot i\right)\right)} + \mathsf{fma}\left(-\left(z \cdot c - a \cdot i\right), b, \left(z \cdot c - a \cdot i\right) \cdot b\right)\right) + j \cdot \left(t \cdot c - y \cdot i\right)
\]
prod-diff [=>]98.9
\[ \left(\color{blue}{\left(\mathsf{fma}\left(x, y \cdot z - t \cdot a, -\left(z \cdot c - a \cdot i\right) \cdot b\right) + \mathsf{fma}\left(-\left(z \cdot c - a \cdot i\right), b, \left(z \cdot c - a \cdot i\right) \cdot b\right)\right)} + \mathsf{fma}\left(-\left(z \cdot c - a \cdot i\right), b, \left(z \cdot c - a \cdot i\right) \cdot b\right)\right) + j \cdot \left(t \cdot c - y \cdot i\right)
\]
*-commutative [<=]98.9
\[ \left(\left(\mathsf{fma}\left(x, y \cdot z - t \cdot a, -\color{blue}{b \cdot \left(z \cdot c - a \cdot i\right)}\right) + \mathsf{fma}\left(-\left(z \cdot c - a \cdot i\right), b, \left(z \cdot c - a \cdot i\right) \cdot b\right)\right) + \mathsf{fma}\left(-\left(z \cdot c - a \cdot i\right), b, \left(z \cdot c - a \cdot i\right) \cdot b\right)\right) + j \cdot \left(t \cdot c - y \cdot i\right)
\]
fma-neg [<=]98.9
\[ \left(\left(\color{blue}{\left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(z \cdot c - a \cdot i\right)\right)} + \mathsf{fma}\left(-\left(z \cdot c - a \cdot i\right), b, \left(z \cdot c - a \cdot i\right) \cdot b\right)\right) + \mathsf{fma}\left(-\left(z \cdot c - a \cdot i\right), b, \left(z \cdot c - a \cdot i\right) \cdot b\right)\right) + j \cdot \left(t \cdot c - y \cdot i\right)
\]
associate-+l+ [=>]98.8
\[ \color{blue}{\left(\left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(z \cdot c - a \cdot i\right)\right) + \left(\mathsf{fma}\left(-\left(z \cdot c - a \cdot i\right), b, \left(z \cdot c - a \cdot i\right) \cdot b\right) + \mathsf{fma}\left(-\left(z \cdot c - a \cdot i\right), b, \left(z \cdot c - a \cdot i\right) \cdot b\right)\right)\right)} + j \cdot \left(t \cdot c - y \cdot i\right)
\]
Recombined 2 regimes into one program.
Final simplification93.4%
\[\leadsto \begin{array}{l}
\mathbf{if}\;j \cdot \left(t \cdot c - y \cdot i\right) + \left(x \cdot \left(y \cdot z - t \cdot a\right) + b \cdot \left(a \cdot i - z \cdot c\right)\right) \leq -1 \cdot 10^{+301} \lor \neg \left(j \cdot \left(t \cdot c - y \cdot i\right) + \left(x \cdot \left(y \cdot z - t \cdot a\right) + b \cdot \left(a \cdot i - z \cdot c\right)\right) \leq 10^{+308}\right):\\
\;\;\;\;\left(\left(c \cdot \left(t \cdot j\right) + y \cdot \left(x \cdot z\right)\right) + i \cdot \left(a \cdot b - y \cdot j\right)\right) - c \cdot \left(z \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\mathsf{fma}\left(x, y \cdot z - t \cdot a, b \cdot \left(a \cdot i - z \cdot c\right)\right) + \left(\mathsf{fma}\left(a \cdot i - z \cdot c, b, b \cdot \left(z \cdot c - a \cdot i\right)\right) + \mathsf{fma}\left(a \cdot i - z \cdot c, b, b \cdot \left(z \cdot c - a \cdot i\right)\right)\right)\right) + j \cdot \left(t \cdot c - y \cdot i\right)\\
\end{array}
\]
Alternatives
Alternative 1
Accuracy
94.0%
Cost
5833
\[\begin{array}{l}
t_1 := x \cdot \left(y \cdot z - t \cdot a\right)\\
t_2 := j \cdot \left(t \cdot c - y \cdot i\right)\\
t_3 := t_2 + \left(t_1 + b \cdot \left(a \cdot i - z \cdot c\right)\right)\\
\mathbf{if}\;t_3 \leq -\infty \lor \neg \left(t_3 \leq 10^{+308}\right):\\
\;\;\;\;\left(\left(c \cdot \left(t \cdot j\right) + y \cdot \left(x \cdot z\right)\right) + i \cdot \left(a \cdot b - y \cdot j\right)\right) - c \cdot \left(z \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;t_2 + \left(t_1 + \left(b \cdot \left(a \cdot i\right) - b \cdot \left(z \cdot c\right)\right)\right)\\
\end{array}
\]
Alternative 2
Accuracy
94.0%
Cost
5705
\[\begin{array}{l}
t_1 := j \cdot \left(t \cdot c - y \cdot i\right) + \left(x \cdot \left(y \cdot z - t \cdot a\right) + b \cdot \left(a \cdot i - z \cdot c\right)\right)\\
\mathbf{if}\;t_1 \leq -\infty \lor \neg \left(t_1 \leq 10^{+308}\right):\\
\;\;\;\;\left(\left(c \cdot \left(t \cdot j\right) + y \cdot \left(x \cdot z\right)\right) + i \cdot \left(a \cdot b - y \cdot j\right)\right) - c \cdot \left(z \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\]
Alternative 3
Accuracy
91.6%
Cost
5704
\[\begin{array}{l}
t_1 := y \cdot \left(x \cdot z\right)\\
t_2 := c \cdot \left(z \cdot b\right)\\
t_3 := j \cdot \left(t \cdot c - y \cdot i\right) + \left(x \cdot \left(y \cdot z - t \cdot a\right) + b \cdot \left(a \cdot i - z \cdot c\right)\right)\\
t_4 := y \cdot \left(i \cdot j\right)\\
\mathbf{if}\;t_3 \leq -\infty:\\
\;\;\;\;\left(\left(t_1 + t \cdot \left(c \cdot j\right)\right) - t_4\right) - t_2\\
\mathbf{elif}\;t_3 \leq 10^{+308}:\\
\;\;\;\;t_3\\
\mathbf{else}:\\
\;\;\;\;\left(\left(c \cdot \left(t \cdot j\right) + t_1\right) - t_4\right) - t_2\\
\end{array}
\]
herbie shell --seed 2023151
(FPCore (x y z t a b c i j)
:name "Linear.Matrix:det33 from linear-1.19.1.3"
:precision binary64
:herbie-target
(if (< t -8.120978919195912e-33) (- (* x (- (* z y) (* a t))) (- (* b (- (* z c) (* a i))) (* (- (* c t) (* y i)) j))) (if (< t -4.712553818218485e-169) (+ (- (* x (- (* y z) (* t a))) (* b (- (* c z) (* i a)))) (/ (* j (- (pow (* c t) 2.0) (pow (* i y) 2.0))) (+ (* c t) (* i y)))) (if (< t -7.633533346031584e-308) (- (* x (- (* z y) (* a t))) (- (* b (- (* z c) (* a i))) (* (- (* c t) (* y i)) j))) (if (< t 1.0535888557455487e-139) (+ (- (* x (- (* y z) (* t a))) (* b (- (* c z) (* i a)))) (/ (* j (- (pow (* c t) 2.0) (pow (* i y) 2.0))) (+ (* c t) (* i y)))) (- (* x (- (* z y) (* a t))) (- (* b (- (* z c) (* a i))) (* (- (* c t) (* y i)) j)))))))
(+ (- (* x (- (* y z) (* t a))) (* b (- (* c z) (* i a)))) (* j (- (* c t) (* i y)))))