| Alternative 1 | |
|---|---|
| Accuracy | 90.2% |
| Cost | 12681 |
(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 (* x (- (* y z) (* t a))))
(t_2 (* j (- (* t c) (* y i))))
(t_3 (+ t_2 (+ t_1 (* b (- (* a i) (* z c)))))))
(if (or (<= t_3 (- INFINITY)) (not (<= t_3 4e+300)))
(+ (+ (* z (* x y)) (- (* a (* b i)) (* c (* z b)))) (* t (* c j)))
(+ (- t_1 (fma (- (* z c) (* a i)) b (* b (fma a (- i) (* a i))))) t_2))))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) - (i * a)))) + (j * ((c * t) - (i * y)));
}
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
double t_1 = x * ((y * z) - (t * a));
double t_2 = j * ((t * c) - (y * i));
double t_3 = t_2 + (t_1 + (b * ((a * i) - (z * c))));
double tmp;
if ((t_3 <= -((double) INFINITY)) || !(t_3 <= 4e+300)) {
tmp = ((z * (x * y)) + ((a * (b * i)) - (c * (z * b)))) + (t * (c * j));
} else {
tmp = (t_1 - fma(((z * c) - (a * i)), b, (b * fma(a, -i, (a * i))))) + t_2;
}
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(i * a)))) + Float64(j * Float64(Float64(c * t) - Float64(i * y)))) end
function code(x, y, z, t, a, b, c, i, j) t_1 = Float64(x * Float64(Float64(y * z) - Float64(t * a))) t_2 = Float64(j * Float64(Float64(t * c) - Float64(y * i))) t_3 = Float64(t_2 + Float64(t_1 + Float64(b * Float64(Float64(a * i) - Float64(z * c))))) tmp = 0.0 if ((t_3 <= Float64(-Inf)) || !(t_3 <= 4e+300)) tmp = Float64(Float64(Float64(z * Float64(x * y)) + Float64(Float64(a * Float64(b * i)) - Float64(c * Float64(z * b)))) + Float64(t * Float64(c * j))); else tmp = Float64(Float64(t_1 - fma(Float64(Float64(z * c) - Float64(a * i)), b, Float64(b * fma(a, Float64(-i), Float64(a * i))))) + t_2); 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[(i * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(j * N[(N[(c * t), $MachinePrecision] - N[(i * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := Block[{t$95$1 = N[(x * N[(N[(y * z), $MachinePrecision] - N[(t * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(j * N[(N[(t * c), $MachinePrecision] - N[(y * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(t$95$2 + N[(t$95$1 + N[(b * N[(N[(a * i), $MachinePrecision] - N[(z * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$3, (-Infinity)], N[Not[LessEqual[t$95$3, 4e+300]], $MachinePrecision]], N[(N[(N[(z * N[(x * y), $MachinePrecision]), $MachinePrecision] + N[(N[(a * N[(b * i), $MachinePrecision]), $MachinePrecision] - N[(c * N[(z * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t * N[(c * j), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$1 - N[(N[(N[(z * c), $MachinePrecision] - N[(a * i), $MachinePrecision]), $MachinePrecision] * b + N[(b * N[(a * (-i) + N[(a * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$2), $MachinePrecision]]]]]
\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 := 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 4 \cdot 10^{+300}\right):\\
\;\;\;\;\left(z \cdot \left(x \cdot y\right) + \left(a \cdot \left(b \cdot i\right) - c \cdot \left(z \cdot b\right)\right)\right) + t \cdot \left(c \cdot j\right)\\
\mathbf{else}:\\
\;\;\;\;\left(t_1 - \mathsf{fma}\left(z \cdot c - a \cdot i, b, b \cdot \mathsf{fma}\left(a, -i, a \cdot i\right)\right)\right) + t_2\\
\end{array}
| Original | 80.2% |
|---|---|
| Target | 74.5% |
| Herbie | 90.2% |
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 or 4.0000000000000002e300 < (+.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 5.2%
Simplified5.2%
[Start]5.2 | \[ \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 [<=]5.2 | \[ \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 [=>]5.2 | \[ \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 [=>]5.2 | \[ \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 [=>]5.2 | \[ \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 [=>]5.2 | \[ \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 [=>]5.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(\color{blue}{t \cdot c} - i \cdot y\right)
\] |
*-commutative [=>]5.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 - \color{blue}{y \cdot i}\right)
\] |
Taylor expanded in t around inf 24.4%
Simplified24.3%
[Start]24.4 | \[ \left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(z \cdot c - a \cdot i\right)\right) + c \cdot \left(t \cdot j\right)
\] |
|---|---|
associate-*r* [=>]9.2 | \[ \left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(z \cdot c - a \cdot i\right)\right) + \color{blue}{\left(c \cdot t\right) \cdot j}
\] |
*-commutative [=>]9.2 | \[ \left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(z \cdot c - a \cdot i\right)\right) + \color{blue}{\left(t \cdot c\right)} \cdot j
\] |
associate-*l* [=>]24.3 | \[ \left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(z \cdot c - a \cdot i\right)\right) + \color{blue}{t \cdot \left(c \cdot j\right)}
\] |
Taylor expanded in y around inf 36.5%
Simplified35.4%
[Start]36.5 | \[ \left(y \cdot \left(z \cdot x\right) - b \cdot \left(z \cdot c - a \cdot i\right)\right) + t \cdot \left(c \cdot j\right)
\] |
|---|---|
associate-*r* [=>]25.6 | \[ \left(\color{blue}{\left(y \cdot z\right) \cdot x} - b \cdot \left(z \cdot c - a \cdot i\right)\right) + t \cdot \left(c \cdot j\right)
\] |
*-commutative [=>]25.6 | \[ \left(\color{blue}{\left(z \cdot y\right)} \cdot x - b \cdot \left(z \cdot c - a \cdot i\right)\right) + t \cdot \left(c \cdot j\right)
\] |
associate-*l* [=>]35.4 | \[ \left(\color{blue}{z \cdot \left(y \cdot x\right)} - b \cdot \left(z \cdot c - a \cdot i\right)\right) + t \cdot \left(c \cdot j\right)
\] |
Taylor expanded in a around 0 56.1%
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.0000000000000002e300Initial program 98.5%
Simplified98.5%
[Start]98.5 | \[ \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.5 | \[ \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.5 | \[ \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.5 | \[ \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.5 | \[ \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.5 | \[ \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.5 | \[ \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.5 | \[ \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-rr68.3%
[Start]98.5 | \[ \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)
\] |
|---|---|
add-cbrt-cube [=>]68.3 | \[ \left(x \cdot \left(y \cdot z - t \cdot a\right) - \color{blue}{\sqrt[3]{\left(\left(b \cdot \left(z \cdot c - a \cdot i\right)\right) \cdot \left(b \cdot \left(z \cdot c - a \cdot i\right)\right)\right) \cdot \left(b \cdot \left(z \cdot c - a \cdot i\right)\right)}}\right) + j \cdot \left(t \cdot c - y \cdot i\right)
\] |
pow3 [=>]68.3 | \[ \left(x \cdot \left(y \cdot z - t \cdot a\right) - \sqrt[3]{\color{blue}{{\left(b \cdot \left(z \cdot c - a \cdot i\right)\right)}^{3}}}\right) + j \cdot \left(t \cdot c - y \cdot i\right)
\] |
Applied egg-rr98.6%
[Start]68.3 | \[ \left(x \cdot \left(y \cdot z - t \cdot a\right) - \sqrt[3]{{\left(b \cdot \left(z \cdot c - a \cdot i\right)\right)}^{3}}\right) + j \cdot \left(t \cdot c - y \cdot i\right)
\] |
|---|---|
rem-cbrt-cube [=>]98.5 | \[ \left(x \cdot \left(y \cdot z - t \cdot a\right) - \color{blue}{b \cdot \left(z \cdot c - a \cdot i\right)}\right) + j \cdot \left(t \cdot c - y \cdot i\right)
\] |
prod-diff [=>]98.5 | \[ \left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \color{blue}{\left(\mathsf{fma}\left(z, c, -i \cdot a\right) + \mathsf{fma}\left(-i, a, i \cdot a\right)\right)}\right) + j \cdot \left(t \cdot c - y \cdot i\right)
\] |
*-commutative [<=]98.5 | \[ \left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(\mathsf{fma}\left(z, c, -\color{blue}{a \cdot i}\right) + \mathsf{fma}\left(-i, a, i \cdot a\right)\right)\right) + j \cdot \left(t \cdot c - y \cdot i\right)
\] |
fma-neg [<=]98.5 | \[ \left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(\color{blue}{\left(z \cdot c - a \cdot i\right)} + \mathsf{fma}\left(-i, a, i \cdot a\right)\right)\right) + j \cdot \left(t \cdot c - y \cdot i\right)
\] |
distribute-rgt-in [=>]98.5 | \[ \left(x \cdot \left(y \cdot z - t \cdot a\right) - \color{blue}{\left(\left(z \cdot c - a \cdot i\right) \cdot b + \mathsf{fma}\left(-i, a, i \cdot a\right) \cdot b\right)}\right) + j \cdot \left(t \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(z \cdot c - a \cdot i, b, \mathsf{fma}\left(-i, a, i \cdot a\right) \cdot b\right)}\right) + j \cdot \left(t \cdot c - y \cdot i\right)
\] |
*-commutative [<=]98.6 | \[ \left(x \cdot \left(y \cdot z - t \cdot a\right) - \mathsf{fma}\left(z \cdot c - a \cdot i, b, \mathsf{fma}\left(-i, a, \color{blue}{a \cdot i}\right) \cdot b\right)\right) + j \cdot \left(t \cdot c - y \cdot i\right)
\] |
fma-udef [=>]98.5 | \[ \left(x \cdot \left(y \cdot z - t \cdot a\right) - \mathsf{fma}\left(z \cdot c - a \cdot i, b, \color{blue}{\left(\left(-i\right) \cdot a + a \cdot i\right)} \cdot b\right)\right) + j \cdot \left(t \cdot c - y \cdot i\right)
\] |
distribute-lft-neg-in [<=]98.5 | \[ \left(x \cdot \left(y \cdot z - t \cdot a\right) - \mathsf{fma}\left(z \cdot c - a \cdot i, b, \left(\color{blue}{\left(-i \cdot a\right)} + a \cdot i\right) \cdot b\right)\right) + j \cdot \left(t \cdot c - y \cdot i\right)
\] |
*-commutative [<=]98.5 | \[ \left(x \cdot \left(y \cdot z - t \cdot a\right) - \mathsf{fma}\left(z \cdot c - a \cdot i, b, \left(\left(-\color{blue}{a \cdot i}\right) + a \cdot i\right) \cdot b\right)\right) + j \cdot \left(t \cdot c - y \cdot i\right)
\] |
distribute-rgt-neg-in [=>]98.5 | \[ \left(x \cdot \left(y \cdot z - t \cdot a\right) - \mathsf{fma}\left(z \cdot c - a \cdot i, b, \left(\color{blue}{a \cdot \left(-i\right)} + a \cdot i\right) \cdot b\right)\right) + j \cdot \left(t \cdot c - y \cdot i\right)
\] |
fma-def [=>]98.6 | \[ \left(x \cdot \left(y \cdot z - t \cdot a\right) - \mathsf{fma}\left(z \cdot c - a \cdot i, b, \color{blue}{\mathsf{fma}\left(a, -i, a \cdot i\right)} \cdot b\right)\right) + j \cdot \left(t \cdot c - y \cdot i\right)
\] |
Final simplification90.2%
| Alternative 1 | |
|---|---|
| Accuracy | 90.2% |
| Cost | 12681 |
| Alternative 2 | |
|---|---|
| Accuracy | 90.2% |
| Cost | 12041 |
| Alternative 3 | |
|---|---|
| Accuracy | 90.2% |
| Cost | 5705 |
| Alternative 4 | |
|---|---|
| Accuracy | 68.0% |
| Cost | 2789 |
| Alternative 5 | |
|---|---|
| Accuracy | 46.9% |
| Cost | 2408 |
| Alternative 6 | |
|---|---|
| Accuracy | 61.8% |
| Cost | 2401 |
| Alternative 7 | |
|---|---|
| Accuracy | 61.8% |
| Cost | 2401 |
| Alternative 8 | |
|---|---|
| Accuracy | 56.1% |
| Cost | 2272 |
| Alternative 9 | |
|---|---|
| Accuracy | 74.8% |
| Cost | 2260 |
| Alternative 10 | |
|---|---|
| Accuracy | 75.6% |
| Cost | 2260 |
| Alternative 11 | |
|---|---|
| Accuracy | 29.7% |
| Cost | 2161 |
| Alternative 12 | |
|---|---|
| Accuracy | 42.6% |
| Cost | 2149 |
| Alternative 13 | |
|---|---|
| Accuracy | 53.0% |
| Cost | 2144 |
| Alternative 14 | |
|---|---|
| Accuracy | 62.1% |
| Cost | 2140 |
| Alternative 15 | |
|---|---|
| Accuracy | 73.1% |
| Cost | 2130 |
| Alternative 16 | |
|---|---|
| Accuracy | 46.3% |
| Cost | 1884 |
| Alternative 17 | |
|---|---|
| Accuracy | 53.3% |
| Cost | 1884 |
| Alternative 18 | |
|---|---|
| Accuracy | 75.7% |
| Cost | 1864 |
| Alternative 19 | |
|---|---|
| Accuracy | 75.4% |
| Cost | 1864 |
| Alternative 20 | |
|---|---|
| Accuracy | 29.3% |
| Cost | 1632 |
| Alternative 21 | |
|---|---|
| Accuracy | 31.8% |
| Cost | 1632 |
| Alternative 22 | |
|---|---|
| Accuracy | 41.2% |
| Cost | 1632 |
| Alternative 23 | |
|---|---|
| Accuracy | 40.4% |
| Cost | 1632 |
| Alternative 24 | |
|---|---|
| Accuracy | 21.2% |
| Cost | 1572 |
| Alternative 25 | |
|---|---|
| Accuracy | 53.7% |
| Cost | 1488 |
| Alternative 26 | |
|---|---|
| Accuracy | 41.8% |
| Cost | 1368 |
| Alternative 27 | |
|---|---|
| Accuracy | 21.5% |
| Cost | 980 |
| Alternative 28 | |
|---|---|
| Accuracy | 22.3% |
| Cost | 980 |
| Alternative 29 | |
|---|---|
| Accuracy | 20.4% |
| Cost | 850 |
| Alternative 30 | |
|---|---|
| Accuracy | 19.8% |
| Cost | 848 |
| Alternative 31 | |
|---|---|
| Accuracy | 16.4% |
| Cost | 320 |
herbie shell --seed 2023150
(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)))))