| Alternative 1 | |
|---|---|
| Accuracy | 92.0% |
| Cost | 18824 |
(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 (* j (- (* a c) (* y i))))
(t_2 (* x (- (* y z) (* t a))))
(t_3 (+ t_1 (+ t_2 (* b (- (* t i) (* z c))))))
(t_4 (* t (- (* b i) (* x a)))))
(if (<= t_3 (- INFINITY))
(+ (+ t_1 t_4) (* z (- (* x y) (* b c))))
(if (<= t_3 1e+298)
(+
t_1
(- t_2 (fma b (- (* z c) (* t i)) (* (fma (- i) t (* t i)) (+ b b)))))
(-
(+ t_4 (* c (* a j)))
(fma z (- (* b c) (* x y)) (* (fma (- x) y (* x y)) (+ z z))))))))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 = j * ((a * c) - (y * i));
double t_2 = x * ((y * z) - (t * a));
double t_3 = t_1 + (t_2 + (b * ((t * i) - (z * c))));
double t_4 = t * ((b * i) - (x * a));
double tmp;
if (t_3 <= -((double) INFINITY)) {
tmp = (t_1 + t_4) + (z * ((x * y) - (b * c)));
} else if (t_3 <= 1e+298) {
tmp = t_1 + (t_2 - fma(b, ((z * c) - (t * i)), (fma(-i, t, (t * i)) * (b + b))));
} else {
tmp = (t_4 + (c * (a * j))) - fma(z, ((b * c) - (x * y)), (fma(-x, y, (x * y)) * (z + z)));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i, j) return Float64(Float64(Float64(x * Float64(Float64(y * z) - Float64(t * a))) - Float64(b * Float64(Float64(c * z) - Float64(t * i)))) + Float64(j * Float64(Float64(c * a) - Float64(y * i)))) end
function code(x, y, z, t, a, b, c, i, j) t_1 = Float64(j * Float64(Float64(a * c) - Float64(y * i))) t_2 = Float64(x * Float64(Float64(y * z) - Float64(t * a))) t_3 = Float64(t_1 + Float64(t_2 + Float64(b * Float64(Float64(t * i) - Float64(z * c))))) t_4 = Float64(t * Float64(Float64(b * i) - Float64(x * a))) tmp = 0.0 if (t_3 <= Float64(-Inf)) tmp = Float64(Float64(t_1 + t_4) + Float64(z * Float64(Float64(x * y) - Float64(b * c)))); elseif (t_3 <= 1e+298) tmp = Float64(t_1 + Float64(t_2 - fma(b, Float64(Float64(z * c) - Float64(t * i)), Float64(fma(Float64(-i), t, Float64(t * i)) * Float64(b + b))))); else tmp = Float64(Float64(t_4 + Float64(c * Float64(a * j))) - fma(z, Float64(Float64(b * c) - Float64(x * y)), Float64(fma(Float64(-x), y, Float64(x * y)) * Float64(z + z)))); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := N[(N[(N[(x * N[(N[(y * z), $MachinePrecision] - N[(t * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(b * N[(N[(c * z), $MachinePrecision] - N[(t * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(j * N[(N[(c * a), $MachinePrecision] - N[(y * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := Block[{t$95$1 = N[(j * N[(N[(a * c), $MachinePrecision] - N[(y * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x * N[(N[(y * z), $MachinePrecision] - N[(t * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(t$95$1 + N[(t$95$2 + N[(b * N[(N[(t * i), $MachinePrecision] - N[(z * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(t * N[(N[(b * i), $MachinePrecision] - N[(x * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$3, (-Infinity)], N[(N[(t$95$1 + t$95$4), $MachinePrecision] + N[(z * N[(N[(x * y), $MachinePrecision] - N[(b * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, 1e+298], N[(t$95$1 + N[(t$95$2 - N[(b * N[(N[(z * c), $MachinePrecision] - N[(t * i), $MachinePrecision]), $MachinePrecision] + N[(N[((-i) * t + N[(t * i), $MachinePrecision]), $MachinePrecision] * N[(b + b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$4 + N[(c * N[(a * j), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(z * N[(N[(b * c), $MachinePrecision] - N[(x * y), $MachinePrecision]), $MachinePrecision] + N[(N[((-x) * y + N[(x * y), $MachinePrecision]), $MachinePrecision] * N[(z + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\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 := j \cdot \left(a \cdot c - y \cdot i\right)\\
t_2 := x \cdot \left(y \cdot z - t \cdot a\right)\\
t_3 := t_1 + \left(t_2 + b \cdot \left(t \cdot i - z \cdot c\right)\right)\\
t_4 := t \cdot \left(b \cdot i - x \cdot a\right)\\
\mathbf{if}\;t_3 \leq -\infty:\\
\;\;\;\;\left(t_1 + t_4\right) + z \cdot \left(x \cdot y - b \cdot c\right)\\
\mathbf{elif}\;t_3 \leq 10^{+298}:\\
\;\;\;\;t_1 + \left(t_2 - \mathsf{fma}\left(b, z \cdot c - t \cdot i, \mathsf{fma}\left(-i, t, t \cdot i\right) \cdot \left(b + b\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(t_4 + c \cdot \left(a \cdot j\right)\right) - \mathsf{fma}\left(z, b \cdot c - x \cdot y, \mathsf{fma}\left(-x, y, x \cdot y\right) \cdot \left(z + z\right)\right)\\
\end{array}
| Original | 80.6% |
|---|---|
| Target | 69.0% |
| Herbie | 92.0% |
if (+.f64 (-.f64 (*.f64 x (-.f64 (*.f64 y z) (*.f64 t a))) (*.f64 b (-.f64 (*.f64 c z) (*.f64 t i)))) (*.f64 j (-.f64 (*.f64 c a) (*.f64 y i)))) < -inf.0Initial program 0.0%
Simplified0.0%
[Start]0.0 | \[ \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)
\] |
|---|---|
associate-+l- [=>]0.0 | \[ \color{blue}{x \cdot \left(y \cdot z - t \cdot a\right) - \left(b \cdot \left(c \cdot z - t \cdot i\right) - j \cdot \left(c \cdot a - y \cdot i\right)\right)}
\] |
fma-neg [=>]0.0 | \[ \color{blue}{\mathsf{fma}\left(x, y \cdot z - t \cdot a, -\left(b \cdot \left(c \cdot z - t \cdot i\right) - j \cdot \left(c \cdot a - y \cdot i\right)\right)\right)}
\] |
neg-sub0 [=>]0.0 | \[ \mathsf{fma}\left(x, y \cdot z - t \cdot a, \color{blue}{0 - \left(b \cdot \left(c \cdot z - t \cdot i\right) - j \cdot \left(c \cdot a - y \cdot i\right)\right)}\right)
\] |
associate-+l- [<=]0.0 | \[ \mathsf{fma}\left(x, y \cdot z - t \cdot a, \color{blue}{\left(0 - b \cdot \left(c \cdot z - t \cdot i\right)\right) + j \cdot \left(c \cdot a - y \cdot i\right)}\right)
\] |
neg-sub0 [<=]0.0 | \[ \mathsf{fma}\left(x, y \cdot z - t \cdot a, \color{blue}{\left(-b \cdot \left(c \cdot z - t \cdot i\right)\right)} + j \cdot \left(c \cdot a - y \cdot i\right)\right)
\] |
distribute-rgt-neg-in [=>]0.0 | \[ \mathsf{fma}\left(x, y \cdot z - t \cdot a, \color{blue}{b \cdot \left(-\left(c \cdot z - t \cdot i\right)\right)} + j \cdot \left(c \cdot a - y \cdot i\right)\right)
\] |
fma-def [=>]0.0 | \[ \mathsf{fma}\left(x, y \cdot z - t \cdot a, \color{blue}{\mathsf{fma}\left(b, -\left(c \cdot z - t \cdot i\right), j \cdot \left(c \cdot a - y \cdot i\right)\right)}\right)
\] |
sub-neg [=>]0.0 | \[ \mathsf{fma}\left(x, y \cdot z - t \cdot a, \mathsf{fma}\left(b, -\color{blue}{\left(c \cdot z + \left(-t \cdot i\right)\right)}, j \cdot \left(c \cdot a - y \cdot i\right)\right)\right)
\] |
distribute-neg-in [=>]0.0 | \[ \mathsf{fma}\left(x, y \cdot z - t \cdot a, \mathsf{fma}\left(b, \color{blue}{\left(-c \cdot z\right) + \left(-\left(-t \cdot i\right)\right)}, j \cdot \left(c \cdot a - y \cdot i\right)\right)\right)
\] |
+-commutative [=>]0.0 | \[ \mathsf{fma}\left(x, y \cdot z - t \cdot a, \mathsf{fma}\left(b, \color{blue}{\left(-\left(-t \cdot i\right)\right) + \left(-c \cdot z\right)}, j \cdot \left(c \cdot a - y \cdot i\right)\right)\right)
\] |
remove-double-neg [=>]0.0 | \[ \mathsf{fma}\left(x, y \cdot z - t \cdot a, \mathsf{fma}\left(b, \color{blue}{t \cdot i} + \left(-c \cdot z\right), j \cdot \left(c \cdot a - y \cdot i\right)\right)\right)
\] |
sub-neg [<=]0.0 | \[ \mathsf{fma}\left(x, y \cdot z - t \cdot a, \mathsf{fma}\left(b, \color{blue}{t \cdot i - c \cdot z}, j \cdot \left(c \cdot a - y \cdot i\right)\right)\right)
\] |
*-commutative [=>]0.0 | \[ \mathsf{fma}\left(x, y \cdot z - t \cdot a, \mathsf{fma}\left(b, t \cdot i - \color{blue}{z \cdot c}, j \cdot \left(c \cdot a - y \cdot i\right)\right)\right)
\] |
*-commutative [=>]0.0 | \[ \mathsf{fma}\left(x, y \cdot z - t \cdot a, \mathsf{fma}\left(b, t \cdot i - z \cdot c, j \cdot \left(\color{blue}{a \cdot c} - y \cdot i\right)\right)\right)
\] |
Taylor expanded in z around -inf 53.1%
Simplified60.6%
[Start]53.1 | \[ i \cdot \left(t \cdot b\right) + \left(-1 \cdot \left(\left(c \cdot b + -1 \cdot \left(y \cdot x\right)\right) \cdot z\right) + \left(-1 \cdot \left(a \cdot \left(t \cdot x\right)\right) + j \cdot \left(c \cdot a - y \cdot i\right)\right)\right)
\] |
|---|---|
+-commutative [=>]53.1 | \[ i \cdot \left(t \cdot b\right) + \color{blue}{\left(\left(-1 \cdot \left(a \cdot \left(t \cdot x\right)\right) + j \cdot \left(c \cdot a - y \cdot i\right)\right) + -1 \cdot \left(\left(c \cdot b + -1 \cdot \left(y \cdot x\right)\right) \cdot z\right)\right)}
\] |
mul-1-neg [=>]53.1 | \[ i \cdot \left(t \cdot b\right) + \left(\left(-1 \cdot \left(a \cdot \left(t \cdot x\right)\right) + j \cdot \left(c \cdot a - y \cdot i\right)\right) + \color{blue}{\left(-\left(c \cdot b + -1 \cdot \left(y \cdot x\right)\right) \cdot z\right)}\right)
\] |
unsub-neg [=>]53.1 | \[ i \cdot \left(t \cdot b\right) + \color{blue}{\left(\left(-1 \cdot \left(a \cdot \left(t \cdot x\right)\right) + j \cdot \left(c \cdot a - y \cdot i\right)\right) - \left(c \cdot b + -1 \cdot \left(y \cdot x\right)\right) \cdot z\right)}
\] |
associate-+r- [=>]53.1 | \[ \color{blue}{\left(i \cdot \left(t \cdot b\right) + \left(-1 \cdot \left(a \cdot \left(t \cdot x\right)\right) + j \cdot \left(c \cdot a - y \cdot i\right)\right)\right) - \left(c \cdot b + -1 \cdot \left(y \cdot x\right)\right) \cdot z}
\] |
if -inf.0 < (+.f64 (-.f64 (*.f64 x (-.f64 (*.f64 y z) (*.f64 t a))) (*.f64 b (-.f64 (*.f64 c z) (*.f64 t i)))) (*.f64 j (-.f64 (*.f64 c a) (*.f64 y i)))) < 9.9999999999999996e297Initial program 98.6%
Simplified98.6%
[Start]98.6 | \[ \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)
\] |
|---|---|
sub-neg [=>]98.6 | \[ \left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - t \cdot i\right)\right) + j \cdot \color{blue}{\left(c \cdot a + \left(-y \cdot i\right)\right)}
\] |
distribute-rgt-in [=>]98.6 | \[ \left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - t \cdot i\right)\right) + \color{blue}{\left(\left(c \cdot a\right) \cdot j + \left(-y \cdot i\right) \cdot j\right)}
\] |
associate-+r+ [=>]98.6 | \[ \color{blue}{\left(\left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - t \cdot i\right)\right) + \left(c \cdot a\right) \cdot j\right) + \left(-y \cdot i\right) \cdot j}
\] |
*-commutative [=>]98.6 | \[ \left(\left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - t \cdot i\right)\right) + \left(c \cdot a\right) \cdot j\right) + \color{blue}{j \cdot \left(-y \cdot i\right)}
\] |
cancel-sign-sub [<=]98.6 | \[ \color{blue}{\left(\left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - t \cdot i\right)\right) + \left(c \cdot a\right) \cdot j\right) - \left(-j\right) \cdot \left(-y \cdot i\right)}
\] |
associate-+r- [<=]98.6 | \[ \color{blue}{\left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - t \cdot i\right)\right) + \left(\left(c \cdot a\right) \cdot j - \left(-j\right) \cdot \left(-y \cdot i\right)\right)}
\] |
*-commutative [=>]98.6 | \[ \left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(\color{blue}{z \cdot c} - t \cdot i\right)\right) + \left(\left(c \cdot a\right) \cdot j - \left(-j\right) \cdot \left(-y \cdot i\right)\right)
\] |
cancel-sign-sub [=>]98.6 | \[ \left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(z \cdot c - t \cdot i\right)\right) + \color{blue}{\left(\left(c \cdot a\right) \cdot j + j \cdot \left(-y \cdot i\right)\right)}
\] |
*-commutative [<=]98.6 | \[ \left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(z \cdot c - t \cdot i\right)\right) + \left(\left(c \cdot a\right) \cdot j + \color{blue}{\left(-y \cdot i\right) \cdot j}\right)
\] |
distribute-rgt-in [<=]98.6 | \[ \left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(z \cdot c - t \cdot i\right)\right) + \color{blue}{j \cdot \left(c \cdot a + \left(-y \cdot i\right)\right)}
\] |
Applied egg-rr98.6%
[Start]98.6 | \[ \left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(z \cdot c - t \cdot i\right)\right) + j \cdot \left(a \cdot c - y \cdot i\right)
\] |
|---|---|
prod-diff [=>]98.6 | \[ \left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \color{blue}{\left(\mathsf{fma}\left(z, c, -i \cdot t\right) + \mathsf{fma}\left(-i, t, i \cdot t\right)\right)}\right) + j \cdot \left(a \cdot c - y \cdot i\right)
\] |
*-commutative [<=]98.6 | \[ \left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(\mathsf{fma}\left(z, c, -\color{blue}{t \cdot i}\right) + \mathsf{fma}\left(-i, t, i \cdot t\right)\right)\right) + j \cdot \left(a \cdot c - y \cdot i\right)
\] |
fma-neg [<=]98.6 | \[ \left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(\color{blue}{\left(z \cdot c - t \cdot i\right)} + \mathsf{fma}\left(-i, t, i \cdot t\right)\right)\right) + j \cdot \left(a \cdot c - y \cdot i\right)
\] |
distribute-lft-in [=>]98.6 | \[ \left(x \cdot \left(y \cdot z - t \cdot a\right) - \color{blue}{\left(b \cdot \left(z \cdot c - t \cdot i\right) + b \cdot \mathsf{fma}\left(-i, t, i \cdot t\right)\right)}\right) + j \cdot \left(a \cdot c - y \cdot i\right)
\] |
prod-diff [=>]98.6 | \[ \left(x \cdot \left(y \cdot z - t \cdot a\right) - \left(b \cdot \color{blue}{\left(\mathsf{fma}\left(z, c, -i \cdot t\right) + \mathsf{fma}\left(-i, t, i \cdot t\right)\right)} + b \cdot \mathsf{fma}\left(-i, t, i \cdot t\right)\right)\right) + j \cdot \left(a \cdot c - y \cdot i\right)
\] |
*-commutative [<=]98.6 | \[ \left(x \cdot \left(y \cdot z - t \cdot a\right) - \left(b \cdot \left(\mathsf{fma}\left(z, c, -\color{blue}{t \cdot i}\right) + \mathsf{fma}\left(-i, t, i \cdot t\right)\right) + b \cdot \mathsf{fma}\left(-i, t, i \cdot t\right)\right)\right) + j \cdot \left(a \cdot c - y \cdot i\right)
\] |
fma-neg [<=]98.6 | \[ \left(x \cdot \left(y \cdot z - t \cdot a\right) - \left(b \cdot \left(\color{blue}{\left(z \cdot c - t \cdot i\right)} + \mathsf{fma}\left(-i, t, i \cdot t\right)\right) + b \cdot \mathsf{fma}\left(-i, t, i \cdot t\right)\right)\right) + j \cdot \left(a \cdot c - y \cdot i\right)
\] |
distribute-lft-in [=>]98.6 | \[ \left(x \cdot \left(y \cdot z - t \cdot a\right) - \left(\color{blue}{\left(b \cdot \left(z \cdot c - t \cdot i\right) + b \cdot \mathsf{fma}\left(-i, t, i \cdot t\right)\right)} + b \cdot \mathsf{fma}\left(-i, t, i \cdot t\right)\right)\right) + j \cdot \left(a \cdot c - y \cdot i\right)
\] |
associate-+l+ [=>]98.6 | \[ \left(x \cdot \left(y \cdot z - t \cdot a\right) - \color{blue}{\left(b \cdot \left(z \cdot c - t \cdot i\right) + \left(b \cdot \mathsf{fma}\left(-i, t, i \cdot t\right) + b \cdot \mathsf{fma}\left(-i, t, i \cdot t\right)\right)\right)}\right) + j \cdot \left(a \cdot c - y \cdot i\right)
\] |
*-commutative [<=]98.6 | \[ \left(x \cdot \left(y \cdot z - t \cdot a\right) - \left(b \cdot \left(z \cdot c - t \cdot i\right) + \left(b \cdot \mathsf{fma}\left(-i, t, \color{blue}{t \cdot i}\right) + b \cdot \mathsf{fma}\left(-i, t, i \cdot t\right)\right)\right)\right) + j \cdot \left(a \cdot c - y \cdot i\right)
\] |
*-commutative [<=]98.6 | \[ \left(x \cdot \left(y \cdot z - t \cdot a\right) - \left(b \cdot \left(z \cdot c - t \cdot i\right) + \left(b \cdot \mathsf{fma}\left(-i, t, t \cdot i\right) + b \cdot \mathsf{fma}\left(-i, t, \color{blue}{t \cdot i}\right)\right)\right)\right) + j \cdot \left(a \cdot c - y \cdot i\right)
\] |
Simplified98.6%
[Start]98.6 | \[ \left(x \cdot \left(y \cdot z - t \cdot a\right) - \left(b \cdot \left(z \cdot c - t \cdot i\right) + \left(b \cdot \mathsf{fma}\left(-i, t, t \cdot i\right) + b \cdot \mathsf{fma}\left(-i, t, t \cdot i\right)\right)\right)\right) + j \cdot \left(a \cdot c - y \cdot i\right)
\] |
|---|---|
fma-def [=>]98.6 | \[ \left(x \cdot \left(y \cdot z - t \cdot a\right) - \color{blue}{\mathsf{fma}\left(b, z \cdot c - t \cdot i, b \cdot \mathsf{fma}\left(-i, t, t \cdot i\right) + b \cdot \mathsf{fma}\left(-i, t, t \cdot i\right)\right)}\right) + j \cdot \left(a \cdot c - y \cdot i\right)
\] |
*-commutative [<=]98.6 | \[ \left(x \cdot \left(y \cdot z - t \cdot a\right) - \mathsf{fma}\left(b, \color{blue}{c \cdot z} - t \cdot i, b \cdot \mathsf{fma}\left(-i, t, t \cdot i\right) + b \cdot \mathsf{fma}\left(-i, t, t \cdot i\right)\right)\right) + j \cdot \left(a \cdot c - y \cdot i\right)
\] |
*-commutative [=>]98.6 | \[ \left(x \cdot \left(y \cdot z - t \cdot a\right) - \mathsf{fma}\left(b, c \cdot z - \color{blue}{i \cdot t}, b \cdot \mathsf{fma}\left(-i, t, t \cdot i\right) + b \cdot \mathsf{fma}\left(-i, t, t \cdot i\right)\right)\right) + j \cdot \left(a \cdot c - y \cdot i\right)
\] |
distribute-rgt-out [=>]98.6 | \[ \left(x \cdot \left(y \cdot z - t \cdot a\right) - \mathsf{fma}\left(b, c \cdot z - i \cdot t, \color{blue}{\mathsf{fma}\left(-i, t, t \cdot i\right) \cdot \left(b + b\right)}\right)\right) + j \cdot \left(a \cdot c - y \cdot i\right)
\] |
*-commutative [=>]98.6 | \[ \left(x \cdot \left(y \cdot z - t \cdot a\right) - \mathsf{fma}\left(b, c \cdot z - i \cdot t, \mathsf{fma}\left(-i, t, \color{blue}{i \cdot t}\right) \cdot \left(b + b\right)\right)\right) + j \cdot \left(a \cdot c - y \cdot i\right)
\] |
if 9.9999999999999996e297 < (+.f64 (-.f64 (*.f64 x (-.f64 (*.f64 y z) (*.f64 t a))) (*.f64 b (-.f64 (*.f64 c z) (*.f64 t i)))) (*.f64 j (-.f64 (*.f64 c a) (*.f64 y i)))) Initial program 11.9%
Simplified11.9%
[Start]11.9 | \[ \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)
\] |
|---|---|
associate-+l- [=>]11.9 | \[ \color{blue}{x \cdot \left(y \cdot z - t \cdot a\right) - \left(b \cdot \left(c \cdot z - t \cdot i\right) - j \cdot \left(c \cdot a - y \cdot i\right)\right)}
\] |
fma-neg [=>]11.9 | \[ \color{blue}{\mathsf{fma}\left(x, y \cdot z - t \cdot a, -\left(b \cdot \left(c \cdot z - t \cdot i\right) - j \cdot \left(c \cdot a - y \cdot i\right)\right)\right)}
\] |
neg-sub0 [=>]11.9 | \[ \mathsf{fma}\left(x, y \cdot z - t \cdot a, \color{blue}{0 - \left(b \cdot \left(c \cdot z - t \cdot i\right) - j \cdot \left(c \cdot a - y \cdot i\right)\right)}\right)
\] |
associate-+l- [<=]11.9 | \[ \mathsf{fma}\left(x, y \cdot z - t \cdot a, \color{blue}{\left(0 - b \cdot \left(c \cdot z - t \cdot i\right)\right) + j \cdot \left(c \cdot a - y \cdot i\right)}\right)
\] |
neg-sub0 [<=]11.9 | \[ \mathsf{fma}\left(x, y \cdot z - t \cdot a, \color{blue}{\left(-b \cdot \left(c \cdot z - t \cdot i\right)\right)} + j \cdot \left(c \cdot a - y \cdot i\right)\right)
\] |
distribute-rgt-neg-in [=>]11.9 | \[ \mathsf{fma}\left(x, y \cdot z - t \cdot a, \color{blue}{b \cdot \left(-\left(c \cdot z - t \cdot i\right)\right)} + j \cdot \left(c \cdot a - y \cdot i\right)\right)
\] |
fma-def [=>]11.9 | \[ \mathsf{fma}\left(x, y \cdot z - t \cdot a, \color{blue}{\mathsf{fma}\left(b, -\left(c \cdot z - t \cdot i\right), j \cdot \left(c \cdot a - y \cdot i\right)\right)}\right)
\] |
sub-neg [=>]11.9 | \[ \mathsf{fma}\left(x, y \cdot z - t \cdot a, \mathsf{fma}\left(b, -\color{blue}{\left(c \cdot z + \left(-t \cdot i\right)\right)}, j \cdot \left(c \cdot a - y \cdot i\right)\right)\right)
\] |
distribute-neg-in [=>]11.9 | \[ \mathsf{fma}\left(x, y \cdot z - t \cdot a, \mathsf{fma}\left(b, \color{blue}{\left(-c \cdot z\right) + \left(-\left(-t \cdot i\right)\right)}, j \cdot \left(c \cdot a - y \cdot i\right)\right)\right)
\] |
+-commutative [=>]11.9 | \[ \mathsf{fma}\left(x, y \cdot z - t \cdot a, \mathsf{fma}\left(b, \color{blue}{\left(-\left(-t \cdot i\right)\right) + \left(-c \cdot z\right)}, j \cdot \left(c \cdot a - y \cdot i\right)\right)\right)
\] |
remove-double-neg [=>]11.9 | \[ \mathsf{fma}\left(x, y \cdot z - t \cdot a, \mathsf{fma}\left(b, \color{blue}{t \cdot i} + \left(-c \cdot z\right), j \cdot \left(c \cdot a - y \cdot i\right)\right)\right)
\] |
sub-neg [<=]11.9 | \[ \mathsf{fma}\left(x, y \cdot z - t \cdot a, \mathsf{fma}\left(b, \color{blue}{t \cdot i - c \cdot z}, j \cdot \left(c \cdot a - y \cdot i\right)\right)\right)
\] |
*-commutative [=>]11.9 | \[ \mathsf{fma}\left(x, y \cdot z - t \cdot a, \mathsf{fma}\left(b, t \cdot i - \color{blue}{z \cdot c}, j \cdot \left(c \cdot a - y \cdot i\right)\right)\right)
\] |
*-commutative [=>]11.9 | \[ \mathsf{fma}\left(x, y \cdot z - t \cdot a, \mathsf{fma}\left(b, t \cdot i - z \cdot c, j \cdot \left(\color{blue}{a \cdot c} - y \cdot i\right)\right)\right)
\] |
Taylor expanded in z around -inf 54.6%
Simplified59.8%
[Start]54.6 | \[ i \cdot \left(t \cdot b\right) + \left(-1 \cdot \left(\left(c \cdot b + -1 \cdot \left(y \cdot x\right)\right) \cdot z\right) + \left(-1 \cdot \left(a \cdot \left(t \cdot x\right)\right) + j \cdot \left(c \cdot a - y \cdot i\right)\right)\right)
\] |
|---|---|
+-commutative [=>]54.6 | \[ i \cdot \left(t \cdot b\right) + \color{blue}{\left(\left(-1 \cdot \left(a \cdot \left(t \cdot x\right)\right) + j \cdot \left(c \cdot a - y \cdot i\right)\right) + -1 \cdot \left(\left(c \cdot b + -1 \cdot \left(y \cdot x\right)\right) \cdot z\right)\right)}
\] |
mul-1-neg [=>]54.6 | \[ i \cdot \left(t \cdot b\right) + \left(\left(-1 \cdot \left(a \cdot \left(t \cdot x\right)\right) + j \cdot \left(c \cdot a - y \cdot i\right)\right) + \color{blue}{\left(-\left(c \cdot b + -1 \cdot \left(y \cdot x\right)\right) \cdot z\right)}\right)
\] |
unsub-neg [=>]54.6 | \[ i \cdot \left(t \cdot b\right) + \color{blue}{\left(\left(-1 \cdot \left(a \cdot \left(t \cdot x\right)\right) + j \cdot \left(c \cdot a - y \cdot i\right)\right) - \left(c \cdot b + -1 \cdot \left(y \cdot x\right)\right) \cdot z\right)}
\] |
associate-+r- [=>]54.6 | \[ \color{blue}{\left(i \cdot \left(t \cdot b\right) + \left(-1 \cdot \left(a \cdot \left(t \cdot x\right)\right) + j \cdot \left(c \cdot a - y \cdot i\right)\right)\right) - \left(c \cdot b + -1 \cdot \left(y \cdot x\right)\right) \cdot z}
\] |
Applied egg-rr59.8%
[Start]59.8 | \[ \left(t \cdot \left(i \cdot b - a \cdot x\right) + j \cdot \left(c \cdot a - i \cdot y\right)\right) - z \cdot \left(c \cdot b - y \cdot x\right)
\] |
|---|---|
prod-diff [=>]59.8 | \[ \left(t \cdot \left(i \cdot b - a \cdot x\right) + j \cdot \left(c \cdot a - i \cdot y\right)\right) - z \cdot \color{blue}{\left(\mathsf{fma}\left(c, b, -x \cdot y\right) + \mathsf{fma}\left(-x, y, x \cdot y\right)\right)}
\] |
*-commutative [<=]59.8 | \[ \left(t \cdot \left(i \cdot b - a \cdot x\right) + j \cdot \left(c \cdot a - i \cdot y\right)\right) - z \cdot \left(\mathsf{fma}\left(c, b, -\color{blue}{y \cdot x}\right) + \mathsf{fma}\left(-x, y, x \cdot y\right)\right)
\] |
fma-neg [<=]59.8 | \[ \left(t \cdot \left(i \cdot b - a \cdot x\right) + j \cdot \left(c \cdot a - i \cdot y\right)\right) - z \cdot \left(\color{blue}{\left(c \cdot b - y \cdot x\right)} + \mathsf{fma}\left(-x, y, x \cdot y\right)\right)
\] |
distribute-lft-in [=>]59.8 | \[ \left(t \cdot \left(i \cdot b - a \cdot x\right) + j \cdot \left(c \cdot a - i \cdot y\right)\right) - \color{blue}{\left(z \cdot \left(c \cdot b - y \cdot x\right) + z \cdot \mathsf{fma}\left(-x, y, x \cdot y\right)\right)}
\] |
prod-diff [=>]59.8 | \[ \left(t \cdot \left(i \cdot b - a \cdot x\right) + j \cdot \left(c \cdot a - i \cdot y\right)\right) - \left(z \cdot \color{blue}{\left(\mathsf{fma}\left(c, b, -x \cdot y\right) + \mathsf{fma}\left(-x, y, x \cdot y\right)\right)} + z \cdot \mathsf{fma}\left(-x, y, x \cdot y\right)\right)
\] |
*-commutative [<=]59.8 | \[ \left(t \cdot \left(i \cdot b - a \cdot x\right) + j \cdot \left(c \cdot a - i \cdot y\right)\right) - \left(z \cdot \left(\mathsf{fma}\left(c, b, -\color{blue}{y \cdot x}\right) + \mathsf{fma}\left(-x, y, x \cdot y\right)\right) + z \cdot \mathsf{fma}\left(-x, y, x \cdot y\right)\right)
\] |
fma-neg [<=]59.8 | \[ \left(t \cdot \left(i \cdot b - a \cdot x\right) + j \cdot \left(c \cdot a - i \cdot y\right)\right) - \left(z \cdot \left(\color{blue}{\left(c \cdot b - y \cdot x\right)} + \mathsf{fma}\left(-x, y, x \cdot y\right)\right) + z \cdot \mathsf{fma}\left(-x, y, x \cdot y\right)\right)
\] |
distribute-lft-in [=>]59.8 | \[ \left(t \cdot \left(i \cdot b - a \cdot x\right) + j \cdot \left(c \cdot a - i \cdot y\right)\right) - \left(\color{blue}{\left(z \cdot \left(c \cdot b - y \cdot x\right) + z \cdot \mathsf{fma}\left(-x, y, x \cdot y\right)\right)} + z \cdot \mathsf{fma}\left(-x, y, x \cdot y\right)\right)
\] |
associate-+l+ [=>]59.8 | \[ \left(t \cdot \left(i \cdot b - a \cdot x\right) + j \cdot \left(c \cdot a - i \cdot y\right)\right) - \color{blue}{\left(z \cdot \left(c \cdot b - y \cdot x\right) + \left(z \cdot \mathsf{fma}\left(-x, y, x \cdot y\right) + z \cdot \mathsf{fma}\left(-x, y, x \cdot y\right)\right)\right)}
\] |
*-commutative [=>]59.8 | \[ \left(t \cdot \left(i \cdot b - a \cdot x\right) + j \cdot \left(c \cdot a - i \cdot y\right)\right) - \left(z \cdot \left(\color{blue}{b \cdot c} - y \cdot x\right) + \left(z \cdot \mathsf{fma}\left(-x, y, x \cdot y\right) + z \cdot \mathsf{fma}\left(-x, y, x \cdot y\right)\right)\right)
\] |
fma-neg [=>]59.8 | \[ \left(t \cdot \left(i \cdot b - a \cdot x\right) + j \cdot \left(c \cdot a - i \cdot y\right)\right) - \left(z \cdot \color{blue}{\mathsf{fma}\left(b, c, -y \cdot x\right)} + \left(z \cdot \mathsf{fma}\left(-x, y, x \cdot y\right) + z \cdot \mathsf{fma}\left(-x, y, x \cdot y\right)\right)\right)
\] |
*-commutative [=>]59.8 | \[ \left(t \cdot \left(i \cdot b - a \cdot x\right) + j \cdot \left(c \cdot a - i \cdot y\right)\right) - \left(z \cdot \mathsf{fma}\left(b, c, -\color{blue}{x \cdot y}\right) + \left(z \cdot \mathsf{fma}\left(-x, y, x \cdot y\right) + z \cdot \mathsf{fma}\left(-x, y, x \cdot y\right)\right)\right)
\] |
Simplified59.8%
[Start]59.8 | \[ \left(t \cdot \left(i \cdot b - a \cdot x\right) + j \cdot \left(c \cdot a - i \cdot y\right)\right) - \left(z \cdot \mathsf{fma}\left(b, c, -x \cdot y\right) + \left(z \cdot \mathsf{fma}\left(-x, y, x \cdot y\right) + z \cdot \mathsf{fma}\left(-x, y, x \cdot y\right)\right)\right)
\] |
|---|---|
distribute-lft-out [=>]59.8 | \[ \left(t \cdot \left(i \cdot b - a \cdot x\right) + j \cdot \left(c \cdot a - i \cdot y\right)\right) - \left(z \cdot \mathsf{fma}\left(b, c, -x \cdot y\right) + \color{blue}{z \cdot \left(\mathsf{fma}\left(-x, y, x \cdot y\right) + \mathsf{fma}\left(-x, y, x \cdot y\right)\right)}\right)
\] |
distribute-rgt-out [<=]59.8 | \[ \left(t \cdot \left(i \cdot b - a \cdot x\right) + j \cdot \left(c \cdot a - i \cdot y\right)\right) - \left(z \cdot \mathsf{fma}\left(b, c, -x \cdot y\right) + \color{blue}{\left(\mathsf{fma}\left(-x, y, x \cdot y\right) \cdot z + \mathsf{fma}\left(-x, y, x \cdot y\right) \cdot z\right)}\right)
\] |
fma-def [=>]59.8 | \[ \left(t \cdot \left(i \cdot b - a \cdot x\right) + j \cdot \left(c \cdot a - i \cdot y\right)\right) - \color{blue}{\mathsf{fma}\left(z, \mathsf{fma}\left(b, c, -x \cdot y\right), \mathsf{fma}\left(-x, y, x \cdot y\right) \cdot z + \mathsf{fma}\left(-x, y, x \cdot y\right) \cdot z\right)}
\] |
fma-neg [<=]59.8 | \[ \left(t \cdot \left(i \cdot b - a \cdot x\right) + j \cdot \left(c \cdot a - i \cdot y\right)\right) - \mathsf{fma}\left(z, \color{blue}{b \cdot c - x \cdot y}, \mathsf{fma}\left(-x, y, x \cdot y\right) \cdot z + \mathsf{fma}\left(-x, y, x \cdot y\right) \cdot z\right)
\] |
distribute-lft-out [=>]59.8 | \[ \left(t \cdot \left(i \cdot b - a \cdot x\right) + j \cdot \left(c \cdot a - i \cdot y\right)\right) - \mathsf{fma}\left(z, b \cdot c - x \cdot y, \color{blue}{\mathsf{fma}\left(-x, y, x \cdot y\right) \cdot \left(z + z\right)}\right)
\] |
Taylor expanded in c around inf 67.8%
Final simplification92.0%
| Alternative 1 | |
|---|---|
| Accuracy | 92.0% |
| Cost | 18824 |
| Alternative 2 | |
|---|---|
| Accuracy | 90.9% |
| Cost | 5705 |
| Alternative 3 | |
|---|---|
| Accuracy | 85.8% |
| Cost | 5704 |
| Alternative 4 | |
|---|---|
| Accuracy | 67.9% |
| Cost | 2788 |
| Alternative 5 | |
|---|---|
| Accuracy | 65.7% |
| Cost | 2656 |
| Alternative 6 | |
|---|---|
| Accuracy | 65.1% |
| Cost | 2405 |
| Alternative 7 | |
|---|---|
| Accuracy | 66.0% |
| Cost | 2405 |
| Alternative 8 | |
|---|---|
| Accuracy | 46.2% |
| Cost | 2280 |
| Alternative 9 | |
|---|---|
| Accuracy | 60.5% |
| Cost | 2272 |
| Alternative 10 | |
|---|---|
| Accuracy | 63.5% |
| Cost | 2268 |
| Alternative 11 | |
|---|---|
| Accuracy | 50.5% |
| Cost | 2148 |
| Alternative 12 | |
|---|---|
| Accuracy | 55.1% |
| Cost | 2141 |
| Alternative 13 | |
|---|---|
| Accuracy | 64.8% |
| Cost | 2136 |
| Alternative 14 | |
|---|---|
| Accuracy | 62.8% |
| Cost | 2008 |
| Alternative 15 | |
|---|---|
| Accuracy | 64.9% |
| Cost | 2008 |
| Alternative 16 | |
|---|---|
| Accuracy | 39.2% |
| Cost | 1896 |
| Alternative 17 | |
|---|---|
| Accuracy | 44.6% |
| Cost | 1885 |
| Alternative 18 | |
|---|---|
| Accuracy | 50.4% |
| Cost | 1752 |
| Alternative 19 | |
|---|---|
| Accuracy | 33.7% |
| Cost | 1632 |
| Alternative 20 | |
|---|---|
| Accuracy | 38.4% |
| Cost | 1632 |
| Alternative 21 | |
|---|---|
| Accuracy | 38.3% |
| Cost | 1632 |
| Alternative 22 | |
|---|---|
| Accuracy | 41.2% |
| Cost | 1236 |
| Alternative 23 | |
|---|---|
| Accuracy | 21.0% |
| Cost | 1112 |
| Alternative 24 | |
|---|---|
| Accuracy | 20.9% |
| Cost | 1044 |
| Alternative 25 | |
|---|---|
| Accuracy | 21.0% |
| Cost | 1044 |
| Alternative 26 | |
|---|---|
| Accuracy | 19.0% |
| Cost | 980 |
| Alternative 27 | |
|---|---|
| Accuracy | 34.5% |
| Cost | 972 |
| Alternative 28 | |
|---|---|
| Accuracy | 18.5% |
| Cost | 585 |
| Alternative 29 | |
|---|---|
| Accuracy | 20.5% |
| Cost | 585 |
| Alternative 30 | |
|---|---|
| Accuracy | 22.9% |
| Cost | 585 |
| Alternative 31 | |
|---|---|
| Accuracy | 16.7% |
| Cost | 320 |
herbie shell --seed 2023135
(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)))))