\[\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 := z \cdot c - a \cdot i\\
t_2 := y \cdot z - t \cdot a\\
t_3 := c \cdot \left(t \cdot j\right)\\
t_4 := x \cdot t_2\\
t_5 := j \cdot \left(t \cdot c - y \cdot i\right)\\
t_6 := \left(t_4 - b \cdot t_1\right) + t_5\\
\mathbf{if}\;t_6 \leq -\infty:\\
\;\;\;\;\mathsf{fma}\left(x, t_2, \mathsf{fma}\left(x, \mathsf{fma}\left(-a, t, t \cdot a\right), i \cdot \left(a \cdot b\right)\right)\right) + t_3\\
\mathbf{elif}\;t_6 \leq 5 \cdot 10^{+284}:\\
\;\;\;\;t_5 + \left(t_4 - \mathsf{fma}\left(b, t_1, \mathsf{fma}\left(-a, i, a \cdot i\right) \cdot \left(b + b\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t_3 + \left(b \cdot \left(a \cdot i - z \cdot c\right) - t \cdot \left(x \cdot a\right)\right)\\
\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 (- (* z c) (* a i)))
(t_2 (- (* y z) (* t a)))
(t_3 (* c (* t j)))
(t_4 (* x t_2))
(t_5 (* j (- (* t c) (* y i))))
(t_6 (+ (- t_4 (* b t_1)) t_5)))
(if (<= t_6 (- INFINITY))
(+ (fma x t_2 (fma x (fma (- a) t (* t a)) (* i (* a b)))) t_3)
(if (<= t_6 5e+284)
(+ t_5 (- t_4 (fma b t_1 (* (fma (- a) i (* a i)) (+ b b)))))
(+ t_3 (- (* b (- (* a i) (* z c))) (* t (* x a))))))))
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)))) < -inf.0
Initial program 0.0%
\[\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)
\]
Taylor expanded in c around inf 20.6%
\[\leadsto \left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - i \cdot a\right)\right) + \color{blue}{c \cdot \left(t \cdot j\right)}
\]
Applied egg-rr20.6%
\[\leadsto \color{blue}{\left(x \cdot \mathsf{fma}\left(y, z, t \cdot \left(-a\right)\right) + \left(x \cdot \mathsf{fma}\left(-a, t, t \cdot a\right) + \mathsf{fma}\left(c, z, i \cdot \left(-a\right)\right) \cdot \left(-b\right)\right)\right)} + c \cdot \left(t \cdot j\right)
\]
Simplified20.6%
\[\leadsto \color{blue}{\mathsf{fma}\left(x, z \cdot y - a \cdot t, \mathsf{fma}\left(x, \mathsf{fma}\left(-a, t, a \cdot t\right), \left(c \cdot z - i \cdot a\right) \cdot \left(-b\right)\right)\right)} + c \cdot \left(t \cdot j\right)
\]
Proof
[Start]20.6
\[ \left(x \cdot \mathsf{fma}\left(y, z, t \cdot \left(-a\right)\right) + \left(x \cdot \mathsf{fma}\left(-a, t, t \cdot a\right) + \mathsf{fma}\left(c, z, i \cdot \left(-a\right)\right) \cdot \left(-b\right)\right)\right) + c \cdot \left(t \cdot j\right)
\]
fma-def [=>]20.6
\[ \color{blue}{\mathsf{fma}\left(x, \mathsf{fma}\left(y, z, t \cdot \left(-a\right)\right), x \cdot \mathsf{fma}\left(-a, t, t \cdot a\right) + \mathsf{fma}\left(c, z, i \cdot \left(-a\right)\right) \cdot \left(-b\right)\right)} + c \cdot \left(t \cdot j\right)
\]
distribute-rgt-neg-out [=>]20.6
\[ \mathsf{fma}\left(x, \mathsf{fma}\left(y, z, \color{blue}{-t \cdot a}\right), x \cdot \mathsf{fma}\left(-a, t, t \cdot a\right) + \mathsf{fma}\left(c, z, i \cdot \left(-a\right)\right) \cdot \left(-b\right)\right) + c \cdot \left(t \cdot j\right)
\]
fma-neg [<=]20.6
\[ \mathsf{fma}\left(x, \color{blue}{y \cdot z - t \cdot a}, x \cdot \mathsf{fma}\left(-a, t, t \cdot a\right) + \mathsf{fma}\left(c, z, i \cdot \left(-a\right)\right) \cdot \left(-b\right)\right) + c \cdot \left(t \cdot j\right)
\]
*-commutative [=>]20.6
\[ \mathsf{fma}\left(x, y \cdot z - \color{blue}{a \cdot t}, x \cdot \mathsf{fma}\left(-a, t, t \cdot a\right) + \mathsf{fma}\left(c, z, i \cdot \left(-a\right)\right) \cdot \left(-b\right)\right) + c \cdot \left(t \cdot j\right)
\]
*-commutative [=>]20.6
\[ \mathsf{fma}\left(x, \color{blue}{z \cdot y} - a \cdot t, x \cdot \mathsf{fma}\left(-a, t, t \cdot a\right) + \mathsf{fma}\left(c, z, i \cdot \left(-a\right)\right) \cdot \left(-b\right)\right) + c \cdot \left(t \cdot j\right)
\]
fma-def [=>]20.6
\[ \mathsf{fma}\left(x, z \cdot y - a \cdot t, \color{blue}{\mathsf{fma}\left(x, \mathsf{fma}\left(-a, t, t \cdot a\right), \mathsf{fma}\left(c, z, i \cdot \left(-a\right)\right) \cdot \left(-b\right)\right)}\right) + c \cdot \left(t \cdot j\right)
\]
*-commutative [=>]20.6
\[ \mathsf{fma}\left(x, z \cdot y - a \cdot t, \mathsf{fma}\left(x, \mathsf{fma}\left(-a, t, \color{blue}{a \cdot t}\right), \mathsf{fma}\left(c, z, i \cdot \left(-a\right)\right) \cdot \left(-b\right)\right)\right) + c \cdot \left(t \cdot j\right)
\]
distribute-rgt-neg-out [=>]20.6
\[ \mathsf{fma}\left(x, z \cdot y - a \cdot t, \mathsf{fma}\left(x, \mathsf{fma}\left(-a, t, a \cdot t\right), \mathsf{fma}\left(c, z, \color{blue}{-i \cdot a}\right) \cdot \left(-b\right)\right)\right) + c \cdot \left(t \cdot j\right)
\]
fma-neg [<=]20.6
\[ \mathsf{fma}\left(x, z \cdot y - a \cdot t, \mathsf{fma}\left(x, \mathsf{fma}\left(-a, t, a \cdot t\right), \color{blue}{\left(c \cdot z - i \cdot a\right)} \cdot \left(-b\right)\right)\right) + c \cdot \left(t \cdot j\right)
\]
Taylor expanded in a around inf 35.3%
\[\leadsto \mathsf{fma}\left(x, z \cdot y - a \cdot t, \mathsf{fma}\left(x, \mathsf{fma}\left(-a, t, a \cdot t\right), \color{blue}{i \cdot \left(a \cdot b\right)}\right)\right) + c \cdot \left(t \cdot j\right)
\]
if -inf.0 < (+.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)))) < 4.9999999999999999e284
Initial program 98.7%
\[\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)
\]
Applied egg-rr98.6%
\[\leadsto \left(x \cdot \left(y \cdot z - t \cdot a\right) - \color{blue}{\left(b \cdot \left(c \cdot z - i \cdot a\right) + \left(b \cdot \mathsf{fma}\left(-a, i, i \cdot a\right) + b \cdot \mathsf{fma}\left(-a, i, i \cdot a\right)\right)\right)}\right) + j \cdot \left(c \cdot t - i \cdot y\right)
\]
Simplified98.7%
\[\leadsto \left(x \cdot \left(y \cdot z - t \cdot a\right) - \color{blue}{\mathsf{fma}\left(b, c \cdot z - i \cdot a, \mathsf{fma}\left(-a, i, i \cdot a\right) \cdot \left(b + b\right)\right)}\right) + j \cdot \left(c \cdot t - i \cdot y\right)
\]
Proof
[Start]98.6
\[ \left(x \cdot \left(y \cdot z - t \cdot a\right) - \left(b \cdot \left(c \cdot z - i \cdot a\right) + \left(b \cdot \mathsf{fma}\left(-a, i, i \cdot a\right) + b \cdot \mathsf{fma}\left(-a, i, i \cdot a\right)\right)\right)\right) + j \cdot \left(c \cdot t - i \cdot y\right)
\]
distribute-lft-out [=>]98.6
\[ \left(x \cdot \left(y \cdot z - t \cdot a\right) - \left(b \cdot \left(c \cdot z - i \cdot a\right) + \color{blue}{b \cdot \left(\mathsf{fma}\left(-a, i, i \cdot a\right) + \mathsf{fma}\left(-a, i, i \cdot a\right)\right)}\right)\right) + j \cdot \left(c \cdot t - i \cdot y\right)
\]
distribute-rgt-out [<=]98.6
\[ \left(x \cdot \left(y \cdot z - t \cdot a\right) - \left(b \cdot \left(c \cdot z - i \cdot a\right) + \color{blue}{\left(\mathsf{fma}\left(-a, i, i \cdot a\right) \cdot b + \mathsf{fma}\left(-a, i, i \cdot a\right) \cdot b\right)}\right)\right) + j \cdot \left(c \cdot t - i \cdot y\right)
\]
fma-def [=>]98.7
\[ \left(x \cdot \left(y \cdot z - t \cdot a\right) - \color{blue}{\mathsf{fma}\left(b, c \cdot z - i \cdot a, \mathsf{fma}\left(-a, i, i \cdot a\right) \cdot b + \mathsf{fma}\left(-a, i, i \cdot a\right) \cdot b\right)}\right) + j \cdot \left(c \cdot t - i \cdot y\right)
\]
distribute-lft-out [=>]98.7
\[ \left(x \cdot \left(y \cdot z - t \cdot a\right) - \mathsf{fma}\left(b, c \cdot z - i \cdot a, \color{blue}{\mathsf{fma}\left(-a, i, i \cdot a\right) \cdot \left(b + b\right)}\right)\right) + j \cdot \left(c \cdot t - i \cdot y\right)
\]
if 4.9999999999999999e284 < (+.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 24.6%
\[\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)
\]
Taylor expanded in c around inf 32.0%
\[\leadsto \left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - i \cdot a\right)\right) + \color{blue}{c \cdot \left(t \cdot j\right)}
\]
Taylor expanded in y around 0 34.8%
\[\leadsto \left(\color{blue}{-1 \cdot \left(a \cdot \left(t \cdot x\right)\right)} - b \cdot \left(c \cdot z - i \cdot a\right)\right) + c \cdot \left(t \cdot j\right)
\]
Simplified36.8%
\[\leadsto \left(\color{blue}{t \cdot \left(x \cdot \left(-a\right)\right)} - b \cdot \left(c \cdot z - i \cdot a\right)\right) + c \cdot \left(t \cdot j\right)
\]
Proof
[Start]34.8
\[ \left(-1 \cdot \left(a \cdot \left(t \cdot x\right)\right) - b \cdot \left(c \cdot z - i \cdot a\right)\right) + c \cdot \left(t \cdot j\right)
\]
mul-1-neg [=>]34.8
\[ \left(\color{blue}{\left(-a \cdot \left(t \cdot x\right)\right)} - b \cdot \left(c \cdot z - i \cdot a\right)\right) + c \cdot \left(t \cdot j\right)
\]
*-commutative [=>]34.8
\[ \left(\left(-\color{blue}{\left(t \cdot x\right) \cdot a}\right) - b \cdot \left(c \cdot z - i \cdot a\right)\right) + c \cdot \left(t \cdot j\right)
\]
distribute-rgt-neg-in [=>]34.8
\[ \left(\color{blue}{\left(t \cdot x\right) \cdot \left(-a\right)} - b \cdot \left(c \cdot z - i \cdot a\right)\right) + c \cdot \left(t \cdot j\right)
\]
associate-*l* [=>]36.8
\[ \left(\color{blue}{t \cdot \left(x \cdot \left(-a\right)\right)} - b \cdot \left(c \cdot z - i \cdot a\right)\right) + c \cdot \left(t \cdot j\right)
\]
Recombined 3 regimes into one program.
Final simplification85.2%
\[\leadsto \begin{array}{l}
\mathbf{if}\;\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) \leq -\infty:\\
\;\;\;\;\mathsf{fma}\left(x, y \cdot z - t \cdot a, \mathsf{fma}\left(x, \mathsf{fma}\left(-a, t, t \cdot a\right), i \cdot \left(a \cdot b\right)\right)\right) + c \cdot \left(t \cdot j\right)\\
\mathbf{elif}\;\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) \leq 5 \cdot 10^{+284}:\\
\;\;\;\;j \cdot \left(t \cdot c - y \cdot i\right) + \left(x \cdot \left(y \cdot z - t \cdot a\right) - \mathsf{fma}\left(b, z \cdot c - a \cdot i, \mathsf{fma}\left(-a, i, a \cdot i\right) \cdot \left(b + b\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;c \cdot \left(t \cdot j\right) + \left(b \cdot \left(a \cdot i - z \cdot c\right) - t \cdot \left(x \cdot a\right)\right)\\
\end{array}
\]
Alternatives
Alternative 1
Accuracy
85.6%
Cost
19080
\[\begin{array}{l}
t_1 := c \cdot \left(t \cdot j\right)\\
t_2 := z \cdot c - a \cdot i\\
t_3 := x \cdot \left(y \cdot z - t \cdot a\right)\\
t_4 := j \cdot \left(t \cdot c - y \cdot i\right)\\
t_5 := \left(t_3 - b \cdot t_2\right) + t_4\\
\mathbf{if}\;t_5 \leq -\infty:\\
\;\;\;\;t_1 + a \cdot \left(b \cdot i - x \cdot t\right)\\
\mathbf{elif}\;t_5 \leq 5 \cdot 10^{+284}:\\
\;\;\;\;t_4 + \left(t_3 - \mathsf{fma}\left(b, t_2, \mathsf{fma}\left(-a, i, a \cdot i\right) \cdot \left(b + b\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t_1 + \left(b \cdot \left(a \cdot i - z \cdot c\right) - t \cdot \left(x \cdot a\right)\right)\\
\end{array}
\]
Alternative 2
Accuracy
85.6%
Cost
5704
\[\begin{array}{l}
t_1 := c \cdot \left(t \cdot j\right)\\
t_2 := \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)\\
\mathbf{if}\;t_2 \leq -\infty:\\
\;\;\;\;t_1 + a \cdot \left(b \cdot i - x \cdot t\right)\\
\mathbf{elif}\;t_2 \leq 5 \cdot 10^{+284}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;t_1 + \left(b \cdot \left(a \cdot i - z \cdot c\right) - t \cdot \left(x \cdot a\right)\right)\\
\end{array}
\]
herbie shell --seed 2023125
(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)))))