Data.Colour.Matrix:determinant from colour-2.3.3, A

?

Percentage Accurate: 73.1% → 83.1%
Time: 27.1s
Precision: binary64
Cost: 16324

?

\[\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 := y \cdot z - t \cdot a\\ t_2 := j \cdot \left(a \cdot c - y \cdot i\right)\\ t_3 := t \cdot i - z \cdot c\\ \mathbf{if}\;t_2 + \left(x \cdot t_1 + b \cdot t_3\right) \leq \infty:\\ \;\;\;\;\mathsf{fma}\left(b, t_3, \mathsf{fma}\left(x, t_1, t_2\right)\right)\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(x \cdot y - b \cdot c\right) - a \cdot \left(x \cdot t - c \cdot j\right)\\ \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 (- (* y z) (* t a)))
        (t_2 (* j (- (* a c) (* y i))))
        (t_3 (- (* t i) (* z c))))
   (if (<= (+ t_2 (+ (* x t_1) (* b t_3))) INFINITY)
     (fma b t_3 (fma x t_1 t_2))
     (- (* z (- (* x y) (* b c))) (* a (- (* x t) (* c j)))))))
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 = (y * z) - (t * a);
	double t_2 = j * ((a * c) - (y * i));
	double t_3 = (t * i) - (z * c);
	double tmp;
	if ((t_2 + ((x * t_1) + (b * t_3))) <= ((double) INFINITY)) {
		tmp = fma(b, t_3, fma(x, t_1, t_2));
	} else {
		tmp = (z * ((x * y) - (b * c))) - (a * ((x * t) - (c * j)));
	}
	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(Float64(y * z) - Float64(t * a))
	t_2 = Float64(j * Float64(Float64(a * c) - Float64(y * i)))
	t_3 = Float64(Float64(t * i) - Float64(z * c))
	tmp = 0.0
	if (Float64(t_2 + Float64(Float64(x * t_1) + Float64(b * t_3))) <= Inf)
		tmp = fma(b, t_3, fma(x, t_1, t_2));
	else
		tmp = Float64(Float64(z * Float64(Float64(x * y) - Float64(b * c))) - Float64(a * Float64(Float64(x * t) - Float64(c * j))));
	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[(N[(y * z), $MachinePrecision] - N[(t * a), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(j * N[(N[(a * c), $MachinePrecision] - N[(y * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(t * i), $MachinePrecision] - N[(z * c), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(t$95$2 + N[(N[(x * t$95$1), $MachinePrecision] + N[(b * t$95$3), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], Infinity], N[(b * t$95$3 + N[(x * t$95$1 + t$95$2), $MachinePrecision]), $MachinePrecision], N[(N[(z * N[(N[(x * y), $MachinePrecision] - N[(b * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(a * N[(N[(x * t), $MachinePrecision] - N[(c * j), $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 := y \cdot z - t \cdot a\\
t_2 := j \cdot \left(a \cdot c - y \cdot i\right)\\
t_3 := t \cdot i - z \cdot c\\
\mathbf{if}\;t_2 + \left(x \cdot t_1 + b \cdot t_3\right) \leq \infty:\\
\;\;\;\;\mathsf{fma}\left(b, t_3, \mathsf{fma}\left(x, t_1, t_2\right)\right)\\

\mathbf{else}:\\
\;\;\;\;z \cdot \left(x \cdot y - b \cdot c\right) - a \cdot \left(x \cdot t - c \cdot j\right)\\


\end{array}

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Herbie found 25 alternatives:

AlternativeAccuracySpeedup

Accuracy vs Speed

The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Bogosity?

Bogosity

Target

Original73.1%
Target59.4%
Herbie83.1%
\[\begin{array}{l} \mathbf{if}\;x < -1.469694296777705 \cdot 10^{-64}:\\ \;\;\;\;\left(x \cdot \left(y \cdot z - t \cdot a\right) - \frac{b \cdot \left({\left(c \cdot z\right)}^{2} - {\left(t \cdot i\right)}^{2}\right)}{c \cdot z + t \cdot i}\right) + j \cdot \left(c \cdot a - y \cdot i\right)\\ \mathbf{elif}\;x < 3.2113527362226803 \cdot 10^{-147}:\\ \;\;\;\;\left(b \cdot i - x \cdot a\right) \cdot t - \left(z \cdot \left(c \cdot b\right) - j \cdot \left(c \cdot a - y \cdot i\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(x \cdot \left(y \cdot z - t \cdot a\right) - \frac{b \cdot \left({\left(c \cdot z\right)}^{2} - {\left(t \cdot i\right)}^{2}\right)}{c \cdot z + t \cdot i}\right) + j \cdot \left(c \cdot a - y \cdot i\right)\\ \end{array} \]

Derivation?

  1. Split input into 2 regimes
  2. 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.0

    1. Initial program 91.1%

      \[\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) \]
    2. Simplified91.1%

      \[\leadsto \color{blue}{\mathsf{fma}\left(b, t \cdot i - z \cdot c, \mathsf{fma}\left(x, y \cdot z - t \cdot a, j \cdot \left(a \cdot c - y \cdot i\right)\right)\right)} \]
      Step-by-step derivation

      [Start]91.1%

      \[ \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 [=>]91.1%

      \[ \color{blue}{\left(x \cdot \left(y \cdot z - t \cdot a\right) + \left(-b \cdot \left(c \cdot z - t \cdot i\right)\right)\right)} + j \cdot \left(c \cdot a - y \cdot i\right) \]

      +-commutative [=>]91.1%

      \[ \color{blue}{\left(\left(-b \cdot \left(c \cdot z - t \cdot i\right)\right) + x \cdot \left(y \cdot z - t \cdot a\right)\right)} + j \cdot \left(c \cdot a - y \cdot i\right) \]

      associate-+l+ [=>]91.1%

      \[ \color{blue}{\left(-b \cdot \left(c \cdot z - t \cdot i\right)\right) + \left(x \cdot \left(y \cdot z - t \cdot a\right) + j \cdot \left(c \cdot a - y \cdot i\right)\right)} \]

      distribute-rgt-neg-in [=>]91.1%

      \[ \color{blue}{b \cdot \left(-\left(c \cdot z - t \cdot i\right)\right)} + \left(x \cdot \left(y \cdot z - t \cdot a\right) + j \cdot \left(c \cdot a - y \cdot i\right)\right) \]

      +-commutative [<=]91.1%

      \[ b \cdot \left(-\left(c \cdot z - t \cdot i\right)\right) + \color{blue}{\left(j \cdot \left(c \cdot a - y \cdot i\right) + x \cdot \left(y \cdot z - t \cdot a\right)\right)} \]

      fma-def [=>]91.1%

      \[ \color{blue}{\mathsf{fma}\left(b, -\left(c \cdot z - t \cdot i\right), j \cdot \left(c \cdot a - y \cdot i\right) + x \cdot \left(y \cdot z - t \cdot a\right)\right)} \]

      sub-neg [=>]91.1%

      \[ \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) + x \cdot \left(y \cdot z - t \cdot a\right)\right) \]

      +-commutative [=>]91.1%

      \[ \mathsf{fma}\left(b, -\color{blue}{\left(\left(-t \cdot i\right) + c \cdot z\right)}, j \cdot \left(c \cdot a - y \cdot i\right) + x \cdot \left(y \cdot z - t \cdot a\right)\right) \]

      distribute-neg-in [=>]91.1%

      \[ \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) + x \cdot \left(y \cdot z - t \cdot a\right)\right) \]

      unsub-neg [=>]91.1%

      \[ \mathsf{fma}\left(b, \color{blue}{\left(-\left(-t \cdot i\right)\right) - c \cdot z}, j \cdot \left(c \cdot a - y \cdot i\right) + x \cdot \left(y \cdot z - t \cdot a\right)\right) \]

      remove-double-neg [=>]91.1%

      \[ \mathsf{fma}\left(b, \color{blue}{t \cdot i} - c \cdot z, j \cdot \left(c \cdot a - y \cdot i\right) + x \cdot \left(y \cdot z - t \cdot a\right)\right) \]

      *-commutative [=>]91.1%

      \[ \mathsf{fma}\left(b, t \cdot i - \color{blue}{z \cdot c}, j \cdot \left(c \cdot a - y \cdot i\right) + x \cdot \left(y \cdot z - t \cdot a\right)\right) \]

    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))))

    1. Initial program 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) \]
    2. Simplified17.6%

      \[\leadsto \color{blue}{\mathsf{fma}\left(b, t \cdot i - z \cdot c, \mathsf{fma}\left(x, y \cdot z - t \cdot a, j \cdot \mathsf{fma}\left(y, -i, a \cdot c\right)\right)\right)} \]
      Step-by-step derivation

      [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) \]

      sub-neg [=>]0.0%

      \[ \color{blue}{\left(x \cdot \left(y \cdot z - t \cdot a\right) + \left(-b \cdot \left(c \cdot z - t \cdot i\right)\right)\right)} + j \cdot \left(c \cdot a - y \cdot i\right) \]

      +-commutative [=>]0.0%

      \[ \color{blue}{\left(\left(-b \cdot \left(c \cdot z - t \cdot i\right)\right) + x \cdot \left(y \cdot z - t \cdot a\right)\right)} + j \cdot \left(c \cdot a - y \cdot i\right) \]

      associate-+l+ [=>]0.0%

      \[ \color{blue}{\left(-b \cdot \left(c \cdot z - t \cdot i\right)\right) + \left(x \cdot \left(y \cdot z - t \cdot a\right) + j \cdot \left(c \cdot a - y \cdot i\right)\right)} \]

      distribute-rgt-neg-in [=>]0.0%

      \[ \color{blue}{b \cdot \left(-\left(c \cdot z - t \cdot i\right)\right)} + \left(x \cdot \left(y \cdot z - t \cdot a\right) + j \cdot \left(c \cdot a - y \cdot i\right)\right) \]

      +-commutative [<=]0.0%

      \[ b \cdot \left(-\left(c \cdot z - t \cdot i\right)\right) + \color{blue}{\left(j \cdot \left(c \cdot a - y \cdot i\right) + x \cdot \left(y \cdot z - t \cdot a\right)\right)} \]

      fma-def [=>]7.8%

      \[ \color{blue}{\mathsf{fma}\left(b, -\left(c \cdot z - t \cdot i\right), j \cdot \left(c \cdot a - y \cdot i\right) + x \cdot \left(y \cdot z - t \cdot a\right)\right)} \]

      sub-neg [=>]7.8%

      \[ \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) + x \cdot \left(y \cdot z - t \cdot a\right)\right) \]

      +-commutative [=>]7.8%

      \[ \mathsf{fma}\left(b, -\color{blue}{\left(\left(-t \cdot i\right) + c \cdot z\right)}, j \cdot \left(c \cdot a - y \cdot i\right) + x \cdot \left(y \cdot z - t \cdot a\right)\right) \]

      distribute-neg-in [=>]7.8%

      \[ \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) + x \cdot \left(y \cdot z - t \cdot a\right)\right) \]

      unsub-neg [=>]7.8%

      \[ \mathsf{fma}\left(b, \color{blue}{\left(-\left(-t \cdot i\right)\right) - c \cdot z}, j \cdot \left(c \cdot a - y \cdot i\right) + x \cdot \left(y \cdot z - t \cdot a\right)\right) \]

      remove-double-neg [=>]7.8%

      \[ \mathsf{fma}\left(b, \color{blue}{t \cdot i} - c \cdot z, j \cdot \left(c \cdot a - y \cdot i\right) + x \cdot \left(y \cdot z - t \cdot a\right)\right) \]

      *-commutative [=>]7.8%

      \[ \mathsf{fma}\left(b, t \cdot i - \color{blue}{z \cdot c}, j \cdot \left(c \cdot a - y \cdot i\right) + x \cdot \left(y \cdot z - t \cdot a\right)\right) \]
    3. Taylor expanded in a around -inf 25.5%

      \[\leadsto \color{blue}{-1 \cdot \left(a \cdot \left(t \cdot x + -1 \cdot \left(c \cdot j\right)\right)\right) + \left(-1 \cdot \left(y \cdot \left(i \cdot j\right)\right) + \left(y \cdot \left(z \cdot x\right) + \left(i \cdot t - c \cdot z\right) \cdot b\right)\right)} \]
    4. Simplified31.4%

      \[\leadsto \color{blue}{\left(y \cdot \left(z \cdot x - i \cdot j\right) - a \cdot \left(t \cdot x - c \cdot j\right)\right) + b \cdot \left(i \cdot t - c \cdot z\right)} \]
      Step-by-step derivation

      [Start]25.5%

      \[ -1 \cdot \left(a \cdot \left(t \cdot x + -1 \cdot \left(c \cdot j\right)\right)\right) + \left(-1 \cdot \left(y \cdot \left(i \cdot j\right)\right) + \left(y \cdot \left(z \cdot x\right) + \left(i \cdot t - c \cdot z\right) \cdot b\right)\right) \]

      associate-+r+ [=>]25.5%

      \[ -1 \cdot \left(a \cdot \left(t \cdot x + -1 \cdot \left(c \cdot j\right)\right)\right) + \color{blue}{\left(\left(-1 \cdot \left(y \cdot \left(i \cdot j\right)\right) + y \cdot \left(z \cdot x\right)\right) + \left(i \cdot t - c \cdot z\right) \cdot b\right)} \]

      +-commutative [=>]25.5%

      \[ -1 \cdot \left(a \cdot \left(t \cdot x + -1 \cdot \left(c \cdot j\right)\right)\right) + \left(\color{blue}{\left(y \cdot \left(z \cdot x\right) + -1 \cdot \left(y \cdot \left(i \cdot j\right)\right)\right)} + \left(i \cdot t - c \cdot z\right) \cdot b\right) \]

      associate-+r+ [=>]25.5%

      \[ \color{blue}{\left(-1 \cdot \left(a \cdot \left(t \cdot x + -1 \cdot \left(c \cdot j\right)\right)\right) + \left(y \cdot \left(z \cdot x\right) + -1 \cdot \left(y \cdot \left(i \cdot j\right)\right)\right)\right) + \left(i \cdot t - c \cdot z\right) \cdot b} \]
    5. Taylor expanded in i around 0 41.4%

      \[\leadsto \color{blue}{\left(-1 \cdot \left(c \cdot \left(z \cdot b\right)\right) + y \cdot \left(z \cdot x\right)\right) - a \cdot \left(t \cdot x - c \cdot j\right)} \]
    6. Simplified55.2%

      \[\leadsto \color{blue}{z \cdot \left(y \cdot x - c \cdot b\right) + a \cdot \left(c \cdot j - t \cdot x\right)} \]
      Step-by-step derivation

      [Start]41.4%

      \[ \left(-1 \cdot \left(c \cdot \left(z \cdot b\right)\right) + y \cdot \left(z \cdot x\right)\right) - a \cdot \left(t \cdot x - c \cdot j\right) \]

      sub-neg [=>]41.4%

      \[ \color{blue}{\left(-1 \cdot \left(c \cdot \left(z \cdot b\right)\right) + y \cdot \left(z \cdot x\right)\right) + \left(-a \cdot \left(t \cdot x - c \cdot j\right)\right)} \]

      *-commutative [=>]41.4%

      \[ \left(-1 \cdot \left(c \cdot \color{blue}{\left(b \cdot z\right)}\right) + y \cdot \left(z \cdot x\right)\right) + \left(-a \cdot \left(t \cdot x - c \cdot j\right)\right) \]

      associate-*r* [=>]43.5%

      \[ \left(-1 \cdot \color{blue}{\left(\left(c \cdot b\right) \cdot z\right)} + y \cdot \left(z \cdot x\right)\right) + \left(-a \cdot \left(t \cdot x - c \cdot j\right)\right) \]

      associate-*r* [=>]43.5%

      \[ \left(\color{blue}{\left(-1 \cdot \left(c \cdot b\right)\right) \cdot z} + y \cdot \left(z \cdot x\right)\right) + \left(-a \cdot \left(t \cdot x - c \cdot j\right)\right) \]

      *-commutative [=>]43.5%

      \[ \left(\left(-1 \cdot \left(c \cdot b\right)\right) \cdot z + y \cdot \color{blue}{\left(x \cdot z\right)}\right) + \left(-a \cdot \left(t \cdot x - c \cdot j\right)\right) \]

      associate-*r* [=>]43.5%

      \[ \left(\left(-1 \cdot \left(c \cdot b\right)\right) \cdot z + \color{blue}{\left(y \cdot x\right) \cdot z}\right) + \left(-a \cdot \left(t \cdot x - c \cdot j\right)\right) \]

      distribute-rgt-in [<=]55.2%

      \[ \color{blue}{z \cdot \left(-1 \cdot \left(c \cdot b\right) + y \cdot x\right)} + \left(-a \cdot \left(t \cdot x - c \cdot j\right)\right) \]

      +-commutative [<=]55.2%

      \[ z \cdot \color{blue}{\left(y \cdot x + -1 \cdot \left(c \cdot b\right)\right)} + \left(-a \cdot \left(t \cdot x - c \cdot j\right)\right) \]

      mul-1-neg [=>]55.2%

      \[ z \cdot \left(y \cdot x + \color{blue}{\left(-c \cdot b\right)}\right) + \left(-a \cdot \left(t \cdot x - c \cdot j\right)\right) \]

      unsub-neg [=>]55.2%

      \[ z \cdot \color{blue}{\left(y \cdot x - c \cdot b\right)} + \left(-a \cdot \left(t \cdot x - c \cdot j\right)\right) \]

      distribute-rgt-neg-in [=>]55.2%

      \[ z \cdot \left(y \cdot x - c \cdot b\right) + \color{blue}{a \cdot \left(-\left(t \cdot x - c \cdot j\right)\right)} \]

      neg-sub0 [=>]55.2%

      \[ z \cdot \left(y \cdot x - c \cdot b\right) + a \cdot \color{blue}{\left(0 - \left(t \cdot x - c \cdot j\right)\right)} \]

      associate-+l- [<=]55.2%

      \[ z \cdot \left(y \cdot x - c \cdot b\right) + a \cdot \color{blue}{\left(\left(0 - t \cdot x\right) + c \cdot j\right)} \]

      neg-sub0 [<=]55.2%

      \[ z \cdot \left(y \cdot x - c \cdot b\right) + a \cdot \left(\color{blue}{\left(-t \cdot x\right)} + c \cdot j\right) \]

      neg-mul-1 [=>]55.2%

      \[ z \cdot \left(y \cdot x - c \cdot b\right) + a \cdot \left(\color{blue}{-1 \cdot \left(t \cdot x\right)} + c \cdot j\right) \]

      +-commutative [<=]55.2%

      \[ z \cdot \left(y \cdot x - c \cdot b\right) + a \cdot \color{blue}{\left(c \cdot j + -1 \cdot \left(t \cdot x\right)\right)} \]

      neg-mul-1 [<=]55.2%

      \[ z \cdot \left(y \cdot x - c \cdot b\right) + a \cdot \left(c \cdot j + \color{blue}{\left(-t \cdot x\right)}\right) \]

      sub-neg [<=]55.2%

      \[ z \cdot \left(y \cdot x - c \cdot b\right) + a \cdot \color{blue}{\left(c \cdot j - t \cdot x\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification83.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;j \cdot \left(a \cdot c - y \cdot i\right) + \left(x \cdot \left(y \cdot z - t \cdot a\right) + b \cdot \left(t \cdot i - z \cdot c\right)\right) \leq \infty:\\ \;\;\;\;\mathsf{fma}\left(b, t \cdot i - z \cdot c, \mathsf{fma}\left(x, y \cdot z - t \cdot a, j \cdot \left(a \cdot c - y \cdot i\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(x \cdot y - b \cdot c\right) - a \cdot \left(x \cdot t - c \cdot j\right)\\ \end{array} \]

Alternatives

Alternative 1
Accuracy83.1%
Cost16324
\[\begin{array}{l} t_1 := y \cdot z - t \cdot a\\ t_2 := j \cdot \left(a \cdot c - y \cdot i\right)\\ t_3 := t \cdot i - z \cdot c\\ \mathbf{if}\;t_2 + \left(x \cdot t_1 + b \cdot t_3\right) \leq \infty:\\ \;\;\;\;\mathsf{fma}\left(b, t_3, \mathsf{fma}\left(x, t_1, t_2\right)\right)\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(x \cdot y - b \cdot c\right) - a \cdot \left(x \cdot t - c \cdot j\right)\\ \end{array} \]
Alternative 2
Accuracy83.1%
Cost3780
\[\begin{array}{l} t_1 := j \cdot \left(a \cdot c - y \cdot i\right) + \left(x \cdot \left(y \cdot z - t \cdot a\right) + b \cdot \left(t \cdot i - z \cdot c\right)\right)\\ \mathbf{if}\;t_1 \leq \infty:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;z \cdot \left(x \cdot y - b \cdot c\right) - a \cdot \left(x \cdot t - c \cdot j\right)\\ \end{array} \]
Alternative 3
Accuracy65.5%
Cost2136
\[\begin{array}{l} t_1 := c \cdot \left(a \cdot j\right)\\ t_2 := \left(t_1 - a \cdot \left(x \cdot t\right)\right) + b \cdot \left(t \cdot i - z \cdot c\right)\\ t_3 := x \cdot \left(y \cdot z - t \cdot a\right)\\ t_4 := y \cdot \left(x \cdot z - i \cdot j\right)\\ \mathbf{if}\;y \leq -7.2 \cdot 10^{+208}:\\ \;\;\;\;t_4\\ \mathbf{elif}\;y \leq -7.2 \cdot 10^{+28}:\\ \;\;\;\;\left(t_3 + t_1\right) - c \cdot \left(z \cdot b\right)\\ \mathbf{elif}\;y \leq -3.4 \cdot 10^{-72}:\\ \;\;\;\;z \cdot \left(x \cdot y - b \cdot c\right) - a \cdot \left(x \cdot t - c \cdot j\right)\\ \mathbf{elif}\;y \leq 4.5 \cdot 10^{-58}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;y \leq 6.8 \cdot 10^{+17}:\\ \;\;\;\;i \cdot \left(t \cdot b\right) + \left(t_3 - y \cdot \left(i \cdot j\right)\right)\\ \mathbf{elif}\;y \leq 1.2 \cdot 10^{+130}:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;t_4\\ \end{array} \]
Alternative 4
Accuracy63.2%
Cost2008
\[\begin{array}{l} t_1 := x \cdot \left(y \cdot z - t \cdot a\right) + i \cdot \left(t \cdot b\right)\\ t_2 := j \cdot \left(a \cdot c - y \cdot i\right) + t \cdot \left(b \cdot i\right)\\ t_3 := z \cdot \left(x \cdot y - b \cdot c\right) - a \cdot \left(x \cdot t - c \cdot j\right)\\ \mathbf{if}\;j \leq -2.9 \cdot 10^{+91}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;j \leq -2.4 \cdot 10^{-166}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;j \leq 4.5 \cdot 10^{-294}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;j \leq 3.3 \cdot 10^{-162}:\\ \;\;\;\;a \cdot \left(c \cdot j - x \cdot t\right) - c \cdot \left(z \cdot b\right)\\ \mathbf{elif}\;j \leq 4.05 \cdot 10^{-115}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;j \leq 1.52 \cdot 10^{+56}:\\ \;\;\;\;t_3\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 5
Accuracy54.1%
Cost1884
\[\begin{array}{l} t_1 := a \cdot \left(c \cdot j - x \cdot t\right)\\ t_2 := x \cdot \left(y \cdot z - t \cdot a\right) + i \cdot \left(t \cdot b\right)\\ \mathbf{if}\;a \leq -4.2 \cdot 10^{+45}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;a \leq -1.5 \cdot 10^{-249}:\\ \;\;\;\;j \cdot \left(a \cdot c - y \cdot i\right) + t \cdot \left(b \cdot i\right)\\ \mathbf{elif}\;a \leq -2.6 \cdot 10^{-277}:\\ \;\;\;\;z \cdot \left(x \cdot y - b \cdot c\right)\\ \mathbf{elif}\;a \leq -1.25 \cdot 10^{-295}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;a \leq 3.5 \cdot 10^{-199}:\\ \;\;\;\;b \cdot \left(t \cdot i - z \cdot c\right)\\ \mathbf{elif}\;a \leq 2.7 \cdot 10^{-151}:\\ \;\;\;\;y \cdot \left(x \cdot z - i \cdot j\right)\\ \mathbf{elif}\;a \leq 10^{+107}:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 6
Accuracy52.7%
Cost1752
\[\begin{array}{l} t_1 := a \cdot \left(c \cdot j - x \cdot t\right)\\ \mathbf{if}\;a \leq -3 \cdot 10^{-51}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;a \leq -1.25 \cdot 10^{-196}:\\ \;\;\;\;y \cdot \left(x \cdot z - i \cdot j\right)\\ \mathbf{elif}\;a \leq -5.8 \cdot 10^{-247}:\\ \;\;\;\;i \cdot \left(t \cdot b - y \cdot j\right)\\ \mathbf{elif}\;a \leq -3 \cdot 10^{-286}:\\ \;\;\;\;z \cdot \left(x \cdot y - b \cdot c\right)\\ \mathbf{elif}\;a \leq 2.8 \cdot 10^{-245}:\\ \;\;\;\;b \cdot \left(t \cdot i - z \cdot c\right)\\ \mathbf{elif}\;a \leq 2.55 \cdot 10^{+107}:\\ \;\;\;\;x \cdot \left(y \cdot z - t \cdot a\right) + i \cdot \left(t \cdot b\right)\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 7
Accuracy66.6%
Cost1740
\[\begin{array}{l} t_1 := c \cdot \left(z \cdot b\right)\\ t_2 := x \cdot \left(y \cdot z - t \cdot a\right)\\ \mathbf{if}\;c \leq -3.2 \cdot 10^{+182}:\\ \;\;\;\;\left(t_2 + c \cdot \left(a \cdot j\right)\right) - t_1\\ \mathbf{elif}\;c \leq -2 \cdot 10^{-100}:\\ \;\;\;\;z \cdot \left(x \cdot y - b \cdot c\right) - a \cdot \left(x \cdot t - c \cdot j\right)\\ \mathbf{elif}\;c \leq 4.9 \cdot 10^{+126}:\\ \;\;\;\;i \cdot \left(t \cdot b\right) + \left(t_2 - y \cdot \left(i \cdot j\right)\right)\\ \mathbf{else}:\\ \;\;\;\;a \cdot \left(c \cdot j - x \cdot t\right) - t_1\\ \end{array} \]
Alternative 8
Accuracy59.0%
Cost1620
\[\begin{array}{l} t_1 := x \cdot \left(y \cdot z - t \cdot a\right) + i \cdot \left(t \cdot b\right)\\ t_2 := t \cdot \left(b \cdot i - x \cdot a\right)\\ \mathbf{if}\;t \leq -2.85 \cdot 10^{+156}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;t \leq -6 \cdot 10^{+22}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq 1.25 \cdot 10^{-144}:\\ \;\;\;\;c \cdot \left(a \cdot j\right) + z \cdot \left(x \cdot y - b \cdot c\right)\\ \mathbf{elif}\;t \leq 5.1 \cdot 10^{-30}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq 2.25 \cdot 10^{+38}:\\ \;\;\;\;j \cdot \left(a \cdot c - y \cdot i\right) + t \cdot \left(b \cdot i\right)\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 9
Accuracy66.7%
Cost1612
\[\begin{array}{l} t_1 := j \cdot \left(a \cdot c - y \cdot i\right) + t \cdot \left(b \cdot i\right)\\ \mathbf{if}\;j \leq -5 \cdot 10^{+91}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;j \leq -2.8 \cdot 10^{-165}:\\ \;\;\;\;z \cdot \left(x \cdot y - b \cdot c\right) - a \cdot \left(x \cdot t - c \cdot j\right)\\ \mathbf{elif}\;j \leq 1.4 \cdot 10^{+43}:\\ \;\;\;\;x \cdot \left(y \cdot z - t \cdot a\right) + b \cdot \left(t \cdot i - z \cdot c\right)\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 10
Accuracy66.6%
Cost1612
\[\begin{array}{l} t_1 := j \cdot \left(a \cdot c - y \cdot i\right) + t \cdot \left(b \cdot i\right)\\ t_2 := x \cdot \left(y \cdot z - t \cdot a\right)\\ \mathbf{if}\;j \leq -4.5 \cdot 10^{+62}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;j \leq -1.85 \cdot 10^{-150}:\\ \;\;\;\;\left(t_2 + c \cdot \left(a \cdot j\right)\right) - c \cdot \left(z \cdot b\right)\\ \mathbf{elif}\;j \leq 3.5 \cdot 10^{+45}:\\ \;\;\;\;t_2 + b \cdot \left(t \cdot i - z \cdot c\right)\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 11
Accuracy49.9%
Cost1500
\[\begin{array}{l} t_1 := y \cdot \left(x \cdot z - i \cdot j\right)\\ t_2 := a \cdot \left(c \cdot j - x \cdot t\right)\\ \mathbf{if}\;a \leq -2.5 \cdot 10^{-52}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;a \leq -2 \cdot 10^{-196}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;a \leq -1.02 \cdot 10^{-250}:\\ \;\;\;\;i \cdot \left(t \cdot b - y \cdot j\right)\\ \mathbf{elif}\;a \leq -1.4 \cdot 10^{-283}:\\ \;\;\;\;z \cdot \left(x \cdot y - b \cdot c\right)\\ \mathbf{elif}\;a \leq 8.2 \cdot 10^{-199}:\\ \;\;\;\;b \cdot \left(t \cdot i - z \cdot c\right)\\ \mathbf{elif}\;a \leq 4.5 \cdot 10^{-149}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;a \leq 1.8 \cdot 10^{+107}:\\ \;\;\;\;t \cdot \left(b \cdot i - x \cdot a\right)\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 12
Accuracy43.0%
Cost1368
\[\begin{array}{l} t_1 := a \cdot \left(c \cdot j - x \cdot t\right)\\ \mathbf{if}\;a \leq -6.4 \cdot 10^{-53}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;a \leq -3 \cdot 10^{-158}:\\ \;\;\;\;y \cdot \left(i \cdot \left(-j\right)\right)\\ \mathbf{elif}\;a \leq -6.3 \cdot 10^{-270}:\\ \;\;\;\;c \cdot \left(a \cdot j - z \cdot b\right)\\ \mathbf{elif}\;a \leq -5.8 \cdot 10^{-284}:\\ \;\;\;\;y \cdot \left(x \cdot z\right)\\ \mathbf{elif}\;a \leq 2.2 \cdot 10^{-198}:\\ \;\;\;\;b \cdot \left(t \cdot i\right)\\ \mathbf{elif}\;a \leq 2.85 \cdot 10^{-151}:\\ \;\;\;\;j \cdot \left(-y \cdot i\right)\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 13
Accuracy51.9%
Cost1368
\[\begin{array}{l} t_1 := i \cdot \left(t \cdot b - y \cdot j\right)\\ t_2 := a \cdot \left(c \cdot j - x \cdot t\right)\\ \mathbf{if}\;a \leq -4.1 \cdot 10^{-51}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;a \leq -4.5 \cdot 10^{-195}:\\ \;\;\;\;y \cdot \left(x \cdot z - i \cdot j\right)\\ \mathbf{elif}\;a \leq -7.9 \cdot 10^{-249}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;a \leq -2.05 \cdot 10^{-283}:\\ \;\;\;\;z \cdot \left(x \cdot y - b \cdot c\right)\\ \mathbf{elif}\;a \leq 1.85 \cdot 10^{-197}:\\ \;\;\;\;b \cdot \left(t \cdot i - z \cdot c\right)\\ \mathbf{elif}\;a \leq 2.35 \cdot 10^{+55}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 14
Accuracy60.7%
Cost1225
\[\begin{array}{l} \mathbf{if}\;y \leq -1.6 \cdot 10^{+161} \lor \neg \left(y \leq 5.5 \cdot 10^{+130}\right):\\ \;\;\;\;y \cdot \left(x \cdot z - i \cdot j\right)\\ \mathbf{else}:\\ \;\;\;\;a \cdot \left(c \cdot j - x \cdot t\right) - c \cdot \left(z \cdot b\right)\\ \end{array} \]
Alternative 15
Accuracy42.9%
Cost1104
\[\begin{array}{l} t_1 := j \cdot \left(-y \cdot i\right)\\ t_2 := a \cdot \left(c \cdot j - x \cdot t\right)\\ \mathbf{if}\;a \leq -9.5 \cdot 10^{-52}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;a \leq -5.9 \cdot 10^{-300}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;a \leq 3.9 \cdot 10^{-199}:\\ \;\;\;\;b \cdot \left(t \cdot i\right)\\ \mathbf{elif}\;a \leq 3.5 \cdot 10^{-151}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 16
Accuracy51.4%
Cost1104
\[\begin{array}{l} t_1 := i \cdot \left(t \cdot b - y \cdot j\right)\\ t_2 := a \cdot \left(c \cdot j - x \cdot t\right)\\ \mathbf{if}\;a \leq -4.5 \cdot 10^{-51}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;a \leq -4.5 \cdot 10^{-250}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;a \leq -4.9 \cdot 10^{-275}:\\ \;\;\;\;c \cdot \left(a \cdot j - z \cdot b\right)\\ \mathbf{elif}\;a \leq 2.5 \cdot 10^{+49}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 17
Accuracy51.6%
Cost1104
\[\begin{array}{l} t_1 := a \cdot \left(c \cdot j - x \cdot t\right)\\ \mathbf{if}\;a \leq -4.3 \cdot 10^{-51}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;a \leq -3.2 \cdot 10^{-157}:\\ \;\;\;\;y \cdot \left(x \cdot z - i \cdot j\right)\\ \mathbf{elif}\;a \leq 8.5 \cdot 10^{-198}:\\ \;\;\;\;b \cdot \left(t \cdot i - z \cdot c\right)\\ \mathbf{elif}\;a \leq 5 \cdot 10^{+49}:\\ \;\;\;\;i \cdot \left(t \cdot b - y \cdot j\right)\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 18
Accuracy52.1%
Cost972
\[\begin{array}{l} t_1 := a \cdot \left(c \cdot j - x \cdot t\right)\\ \mathbf{if}\;a \leq -4.5 \cdot 10^{-51}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;a \leq -3 \cdot 10^{-196}:\\ \;\;\;\;y \cdot \left(x \cdot z - i \cdot j\right)\\ \mathbf{elif}\;a \leq 1.06 \cdot 10^{+46}:\\ \;\;\;\;i \cdot \left(t \cdot b - y \cdot j\right)\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 19
Accuracy29.7%
Cost912
\[\begin{array}{l} t_1 := i \cdot \left(y \cdot \left(-j\right)\right)\\ \mathbf{if}\;c \leq -1.22 \cdot 10^{-102}:\\ \;\;\;\;c \cdot \left(-z \cdot b\right)\\ \mathbf{elif}\;c \leq -7.8 \cdot 10^{-299}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;c \leq 5.2 \cdot 10^{-135}:\\ \;\;\;\;i \cdot \left(t \cdot b\right)\\ \mathbf{elif}\;c \leq 1.75 \cdot 10^{+80}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;a \cdot \left(c \cdot j\right)\\ \end{array} \]
Alternative 20
Accuracy30.5%
Cost912
\[\begin{array}{l} \mathbf{if}\;c \leq -1.55 \cdot 10^{-20}:\\ \;\;\;\;c \cdot \left(-z \cdot b\right)\\ \mathbf{elif}\;c \leq -5.6 \cdot 10^{-306}:\\ \;\;\;\;y \cdot \left(i \cdot \left(-j\right)\right)\\ \mathbf{elif}\;c \leq 2.25 \cdot 10^{-132}:\\ \;\;\;\;i \cdot \left(t \cdot b\right)\\ \mathbf{elif}\;c \leq 6.8 \cdot 10^{+78}:\\ \;\;\;\;i \cdot \left(y \cdot \left(-j\right)\right)\\ \mathbf{else}:\\ \;\;\;\;a \cdot \left(c \cdot j\right)\\ \end{array} \]
Alternative 21
Accuracy30.6%
Cost912
\[\begin{array}{l} \mathbf{if}\;c \leq -1.6 \cdot 10^{-21}:\\ \;\;\;\;c \cdot \left(-z \cdot b\right)\\ \mathbf{elif}\;c \leq -3 \cdot 10^{-293}:\\ \;\;\;\;j \cdot \left(-y \cdot i\right)\\ \mathbf{elif}\;c \leq 2.15 \cdot 10^{-134}:\\ \;\;\;\;i \cdot \left(t \cdot b\right)\\ \mathbf{elif}\;c \leq 1.9 \cdot 10^{+81}:\\ \;\;\;\;i \cdot \left(y \cdot \left(-j\right)\right)\\ \mathbf{else}:\\ \;\;\;\;a \cdot \left(c \cdot j\right)\\ \end{array} \]
Alternative 22
Accuracy30.9%
Cost912
\[\begin{array}{l} \mathbf{if}\;c \leq -3.8 \cdot 10^{-22}:\\ \;\;\;\;b \cdot \left(c \cdot \left(-z\right)\right)\\ \mathbf{elif}\;c \leq -4.2 \cdot 10^{-295}:\\ \;\;\;\;j \cdot \left(-y \cdot i\right)\\ \mathbf{elif}\;c \leq 2.5 \cdot 10^{-137}:\\ \;\;\;\;i \cdot \left(t \cdot b\right)\\ \mathbf{elif}\;c \leq 1.5 \cdot 10^{+80}:\\ \;\;\;\;i \cdot \left(y \cdot \left(-j\right)\right)\\ \mathbf{else}:\\ \;\;\;\;a \cdot \left(c \cdot j\right)\\ \end{array} \]
Alternative 23
Accuracy29.5%
Cost585
\[\begin{array}{l} \mathbf{if}\;c \leq -1.02 \cdot 10^{-25} \lor \neg \left(c \leq 3.7 \cdot 10^{+50}\right):\\ \;\;\;\;a \cdot \left(c \cdot j\right)\\ \mathbf{else}:\\ \;\;\;\;i \cdot \left(t \cdot b\right)\\ \end{array} \]
Alternative 24
Accuracy29.2%
Cost584
\[\begin{array}{l} \mathbf{if}\;c \leq -1.45 \cdot 10^{-46}:\\ \;\;\;\;c \cdot \left(-z \cdot b\right)\\ \mathbf{elif}\;c \leq 6.2 \cdot 10^{+50}:\\ \;\;\;\;i \cdot \left(t \cdot b\right)\\ \mathbf{else}:\\ \;\;\;\;a \cdot \left(c \cdot j\right)\\ \end{array} \]
Alternative 25
Accuracy22.3%
Cost320
\[a \cdot \left(c \cdot j\right) \]

Reproduce?

herbie shell --seed 2023171 
(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)))))