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

Percentage Accurate: 73.3% → 81.9%
Time: 20.0s
Alternatives: 17
Speedup: 0.5×

Specification

?
\[\begin{array}{l} \\ \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) \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)))))
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)));
}
real(8) function code(x, y, z, t, a, b, c, i, j)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    real(8), intent (in) :: i
    real(8), intent (in) :: j
    code = ((x * ((y * z) - (t * a))) - (b * ((c * z) - (t * i)))) + (j * ((c * a) - (y * i)))
end function
public static 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)));
}
def code(x, y, z, t, a, b, c, i, j):
	return ((x * ((y * z) - (t * a))) - (b * ((c * z) - (t * i)))) + (j * ((c * a) - (y * i)))
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 tmp = code(x, y, z, t, a, b, c, i, j)
	tmp = ((x * ((y * z) - (t * a))) - (b * ((c * z) - (t * i)))) + (j * ((c * a) - (y * i)));
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]
\begin{array}{l}

\\
\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)
\end{array}

Sampling outcomes in binary64 precision:

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.

Accuracy vs Speed?

Herbie found 17 alternatives:

AlternativeAccuracySpeedup
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.

Initial Program: 73.3% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \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) \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)))))
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)));
}
real(8) function code(x, y, z, t, a, b, c, i, j)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    real(8), intent (in) :: i
    real(8), intent (in) :: j
    code = ((x * ((y * z) - (t * a))) - (b * ((c * z) - (t * i)))) + (j * ((c * a) - (y * i)))
end function
public static 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)));
}
def code(x, y, z, t, a, b, c, i, j):
	return ((x * ((y * z) - (t * a))) - (b * ((c * z) - (t * i)))) + (j * ((c * a) - (y * i)))
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 tmp = code(x, y, z, t, a, b, c, i, j)
	tmp = ((x * ((y * z) - (t * a))) - (b * ((c * z) - (t * i)))) + (j * ((c * a) - (y * i)));
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]
\begin{array}{l}

\\
\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)
\end{array}

Alternative 1: 81.9% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := \left(x \cdot \left(y \cdot z - t \cdot a\right) + b \cdot \left(t \cdot i - z \cdot c\right)\right) + j \cdot \left(a \cdot c - y \cdot i\right)\\ \mathbf{if}\;t\_1 \leq \infty:\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;t \cdot \mathsf{fma}\left(a, -x, b \cdot i\right)\\ \end{array} \end{array} \]
(FPCore (x y z t a b c i j)
 :precision binary64
 (let* ((t_1
         (+
          (+ (* x (- (* y z) (* t a))) (* b (- (* t i) (* z c))))
          (* j (- (* a c) (* y i))))))
   (if (<= t_1 INFINITY) t_1 (* t (fma a (- x) (* b i))))))
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))) + (b * ((t * i) - (z * c)))) + (j * ((a * c) - (y * i)));
	double tmp;
	if (t_1 <= ((double) INFINITY)) {
		tmp = t_1;
	} else {
		tmp = t * fma(a, -x, (b * i));
	}
	return tmp;
}
function code(x, y, z, t, a, b, c, i, j)
	t_1 = Float64(Float64(Float64(x * Float64(Float64(y * z) - Float64(t * a))) + Float64(b * Float64(Float64(t * i) - Float64(z * c)))) + Float64(j * Float64(Float64(a * c) - Float64(y * i))))
	tmp = 0.0
	if (t_1 <= Inf)
		tmp = t_1;
	else
		tmp = Float64(t * fma(a, Float64(-x), Float64(b * i)));
	end
	return tmp
end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := Block[{t$95$1 = N[(N[(N[(x * N[(N[(y * z), $MachinePrecision] - N[(t * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(b * N[(N[(t * i), $MachinePrecision] - N[(z * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(j * N[(N[(a * c), $MachinePrecision] - N[(y * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, Infinity], t$95$1, N[(t * N[(a * (-x) + N[(b * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := \left(x \cdot \left(y \cdot z - t \cdot a\right) + b \cdot \left(t \cdot i - z \cdot c\right)\right) + j \cdot \left(a \cdot c - y \cdot i\right)\\
\mathbf{if}\;t\_1 \leq \infty:\\
\;\;\;\;t\_1\\

\mathbf{else}:\\
\;\;\;\;t \cdot \mathsf{fma}\left(a, -x, b \cdot i\right)\\


\end{array}
\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 94.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. Add Preprocessing

    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. Add Preprocessing
    3. Taylor expanded in t around inf

      \[\leadsto \color{blue}{t \cdot \left(-1 \cdot \left(a \cdot x\right) - -1 \cdot \left(b \cdot i\right)\right)} \]
    4. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto \color{blue}{t \cdot \left(-1 \cdot \left(a \cdot x\right) - -1 \cdot \left(b \cdot i\right)\right)} \]
      2. sub-negN/A

        \[\leadsto t \cdot \color{blue}{\left(-1 \cdot \left(a \cdot x\right) + \left(\mathsf{neg}\left(-1 \cdot \left(b \cdot i\right)\right)\right)\right)} \]
      3. mul-1-negN/A

        \[\leadsto t \cdot \left(\color{blue}{\left(\mathsf{neg}\left(a \cdot x\right)\right)} + \left(\mathsf{neg}\left(-1 \cdot \left(b \cdot i\right)\right)\right)\right) \]
      4. distribute-rgt-neg-inN/A

        \[\leadsto t \cdot \left(\color{blue}{a \cdot \left(\mathsf{neg}\left(x\right)\right)} + \left(\mathsf{neg}\left(-1 \cdot \left(b \cdot i\right)\right)\right)\right) \]
      5. mul-1-negN/A

        \[\leadsto t \cdot \left(a \cdot \color{blue}{\left(-1 \cdot x\right)} + \left(\mathsf{neg}\left(-1 \cdot \left(b \cdot i\right)\right)\right)\right) \]
      6. mul-1-negN/A

        \[\leadsto t \cdot \left(a \cdot \left(-1 \cdot x\right) + \left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(b \cdot i\right)\right)}\right)\right)\right) \]
      7. remove-double-negN/A

        \[\leadsto t \cdot \left(a \cdot \left(-1 \cdot x\right) + \color{blue}{b \cdot i}\right) \]
      8. lower-fma.f64N/A

        \[\leadsto t \cdot \color{blue}{\mathsf{fma}\left(a, -1 \cdot x, b \cdot i\right)} \]
      9. mul-1-negN/A

        \[\leadsto t \cdot \mathsf{fma}\left(a, \color{blue}{\mathsf{neg}\left(x\right)}, b \cdot i\right) \]
      10. lower-neg.f64N/A

        \[\leadsto t \cdot \mathsf{fma}\left(a, \color{blue}{\mathsf{neg}\left(x\right)}, b \cdot i\right) \]
      11. *-commutativeN/A

        \[\leadsto t \cdot \mathsf{fma}\left(a, \mathsf{neg}\left(x\right), \color{blue}{i \cdot b}\right) \]
      12. lower-*.f6462.6

        \[\leadsto t \cdot \mathsf{fma}\left(a, -x, \color{blue}{i \cdot b}\right) \]
    5. Applied rewrites62.6%

      \[\leadsto \color{blue}{t \cdot \mathsf{fma}\left(a, -x, i \cdot b\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification87.0%

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

Alternative 2: 60.1% accurate, 1.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_1 := t \cdot \mathsf{fma}\left(a, -x, b \cdot i\right)\\ t_2 := j \cdot \left(a \cdot c - y \cdot i\right)\\ \mathbf{if}\;t \leq -8.6 \cdot 10^{+15}:\\ \;\;\;\;\mathsf{fma}\left(j, a \cdot c, t\_1\right)\\ \mathbf{elif}\;t \leq -3.6 \cdot 10^{-147}:\\ \;\;\;\;t\_2 + t \cdot \left(b \cdot i\right)\\ \mathbf{elif}\;t \leq 3.6 \cdot 10^{+74}:\\ \;\;\;\;t\_2 + y \cdot \left(x \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (x y z t a b c i j)
 :precision binary64
 (let* ((t_1 (* t (fma a (- x) (* b i)))) (t_2 (* j (- (* a c) (* y i)))))
   (if (<= t -8.6e+15)
     (fma j (* a c) t_1)
     (if (<= t -3.6e-147)
       (+ t_2 (* t (* b i)))
       (if (<= t 3.6e+74) (+ t_2 (* y (* x z))) t_1)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
	double t_1 = t * fma(a, -x, (b * i));
	double t_2 = j * ((a * c) - (y * i));
	double tmp;
	if (t <= -8.6e+15) {
		tmp = fma(j, (a * c), t_1);
	} else if (t <= -3.6e-147) {
		tmp = t_2 + (t * (b * i));
	} else if (t <= 3.6e+74) {
		tmp = t_2 + (y * (x * z));
	} else {
		tmp = t_1;
	}
	return tmp;
}
function code(x, y, z, t, a, b, c, i, j)
	t_1 = Float64(t * fma(a, Float64(-x), Float64(b * i)))
	t_2 = Float64(j * Float64(Float64(a * c) - Float64(y * i)))
	tmp = 0.0
	if (t <= -8.6e+15)
		tmp = fma(j, Float64(a * c), t_1);
	elseif (t <= -3.6e-147)
		tmp = Float64(t_2 + Float64(t * Float64(b * i)));
	elseif (t <= 3.6e+74)
		tmp = Float64(t_2 + Float64(y * Float64(x * z)));
	else
		tmp = t_1;
	end
	return tmp
end
code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := Block[{t$95$1 = N[(t * N[(a * (-x) + N[(b * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(j * N[(N[(a * c), $MachinePrecision] - N[(y * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -8.6e+15], N[(j * N[(a * c), $MachinePrecision] + t$95$1), $MachinePrecision], If[LessEqual[t, -3.6e-147], N[(t$95$2 + N[(t * N[(b * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 3.6e+74], N[(t$95$2 + N[(y * N[(x * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_1 := t \cdot \mathsf{fma}\left(a, -x, b \cdot i\right)\\
t_2 := j \cdot \left(a \cdot c - y \cdot i\right)\\
\mathbf{if}\;t \leq -8.6 \cdot 10^{+15}:\\
\;\;\;\;\mathsf{fma}\left(j, a \cdot c, t\_1\right)\\

\mathbf{elif}\;t \leq -3.6 \cdot 10^{-147}:\\
\;\;\;\;t\_2 + t \cdot \left(b \cdot i\right)\\

\mathbf{elif}\;t \leq 3.6 \cdot 10^{+74}:\\
\;\;\;\;t\_2 + y \cdot \left(x \cdot z\right)\\

\mathbf{else}:\\
\;\;\;\;t\_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if t < -8.6e15

    1. Initial program 67.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. Add Preprocessing
    3. Taylor expanded in z around 0

      \[\leadsto \color{blue}{\left(-1 \cdot \left(a \cdot \left(t \cdot x\right)\right) + j \cdot \left(a \cdot c - i \cdot y\right)\right) - -1 \cdot \left(b \cdot \left(i \cdot t\right)\right)} \]
    4. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \color{blue}{\left(j \cdot \left(a \cdot c - i \cdot y\right) + -1 \cdot \left(a \cdot \left(t \cdot x\right)\right)\right)} - -1 \cdot \left(b \cdot \left(i \cdot t\right)\right) \]
      2. associate--l+N/A

        \[\leadsto \color{blue}{j \cdot \left(a \cdot c - i \cdot y\right) + \left(-1 \cdot \left(a \cdot \left(t \cdot x\right)\right) - -1 \cdot \left(b \cdot \left(i \cdot t\right)\right)\right)} \]
      3. cancel-sign-sub-invN/A

        \[\leadsto j \cdot \left(a \cdot c - i \cdot y\right) + \color{blue}{\left(-1 \cdot \left(a \cdot \left(t \cdot x\right)\right) + \left(\mathsf{neg}\left(-1\right)\right) \cdot \left(b \cdot \left(i \cdot t\right)\right)\right)} \]
      4. *-commutativeN/A

        \[\leadsto j \cdot \left(a \cdot c - i \cdot y\right) + \left(-1 \cdot \left(a \cdot \color{blue}{\left(x \cdot t\right)}\right) + \left(\mathsf{neg}\left(-1\right)\right) \cdot \left(b \cdot \left(i \cdot t\right)\right)\right) \]
      5. associate-*r*N/A

        \[\leadsto j \cdot \left(a \cdot c - i \cdot y\right) + \left(-1 \cdot \color{blue}{\left(\left(a \cdot x\right) \cdot t\right)} + \left(\mathsf{neg}\left(-1\right)\right) \cdot \left(b \cdot \left(i \cdot t\right)\right)\right) \]
      6. associate-*l*N/A

        \[\leadsto j \cdot \left(a \cdot c - i \cdot y\right) + \left(\color{blue}{\left(-1 \cdot \left(a \cdot x\right)\right) \cdot t} + \left(\mathsf{neg}\left(-1\right)\right) \cdot \left(b \cdot \left(i \cdot t\right)\right)\right) \]
      7. metadata-evalN/A

        \[\leadsto j \cdot \left(a \cdot c - i \cdot y\right) + \left(\left(-1 \cdot \left(a \cdot x\right)\right) \cdot t + \color{blue}{1} \cdot \left(b \cdot \left(i \cdot t\right)\right)\right) \]
      8. *-lft-identityN/A

        \[\leadsto j \cdot \left(a \cdot c - i \cdot y\right) + \left(\left(-1 \cdot \left(a \cdot x\right)\right) \cdot t + \color{blue}{b \cdot \left(i \cdot t\right)}\right) \]
      9. associate-*r*N/A

        \[\leadsto j \cdot \left(a \cdot c - i \cdot y\right) + \left(\left(-1 \cdot \left(a \cdot x\right)\right) \cdot t + \color{blue}{\left(b \cdot i\right) \cdot t}\right) \]
      10. distribute-rgt-inN/A

        \[\leadsto j \cdot \left(a \cdot c - i \cdot y\right) + \color{blue}{t \cdot \left(-1 \cdot \left(a \cdot x\right) + b \cdot i\right)} \]
      11. *-lft-identityN/A

        \[\leadsto j \cdot \left(a \cdot c - i \cdot y\right) + t \cdot \left(-1 \cdot \left(a \cdot x\right) + \color{blue}{1 \cdot \left(b \cdot i\right)}\right) \]
      12. metadata-evalN/A

        \[\leadsto j \cdot \left(a \cdot c - i \cdot y\right) + t \cdot \left(-1 \cdot \left(a \cdot x\right) + \color{blue}{\left(\mathsf{neg}\left(-1\right)\right)} \cdot \left(b \cdot i\right)\right) \]
      13. cancel-sign-sub-invN/A

        \[\leadsto j \cdot \left(a \cdot c - i \cdot y\right) + t \cdot \color{blue}{\left(-1 \cdot \left(a \cdot x\right) - -1 \cdot \left(b \cdot i\right)\right)} \]
      14. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(j, a \cdot c - i \cdot y, t \cdot \left(-1 \cdot \left(a \cdot x\right) - -1 \cdot \left(b \cdot i\right)\right)\right)} \]
    5. Applied rewrites71.3%

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

      \[\leadsto \mathsf{fma}\left(j, a \cdot \color{blue}{c}, t \cdot \mathsf{fma}\left(a, \mathsf{neg}\left(x\right), i \cdot b\right)\right) \]
    7. Step-by-step derivation
      1. Applied rewrites65.7%

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

      if -8.6e15 < t < -3.60000000000000012e-147

      1. Initial program 83.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) \]
      2. Add Preprocessing
      3. Taylor expanded in i around inf

        \[\leadsto \color{blue}{b \cdot \left(i \cdot t\right)} + j \cdot \left(c \cdot a - y \cdot i\right) \]
      4. Step-by-step derivation
        1. associate-*r*N/A

          \[\leadsto \color{blue}{\left(b \cdot i\right) \cdot t} + j \cdot \left(c \cdot a - y \cdot i\right) \]
        2. *-commutativeN/A

          \[\leadsto \color{blue}{t \cdot \left(b \cdot i\right)} + j \cdot \left(c \cdot a - y \cdot i\right) \]
        3. lower-*.f64N/A

          \[\leadsto \color{blue}{t \cdot \left(b \cdot i\right)} + j \cdot \left(c \cdot a - y \cdot i\right) \]
        4. *-commutativeN/A

          \[\leadsto t \cdot \color{blue}{\left(i \cdot b\right)} + j \cdot \left(c \cdot a - y \cdot i\right) \]
        5. lower-*.f6450.7

          \[\leadsto t \cdot \color{blue}{\left(i \cdot b\right)} + j \cdot \left(c \cdot a - y \cdot i\right) \]
      5. Applied rewrites50.7%

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

      if -3.60000000000000012e-147 < t < 3.59999999999999988e74

      1. Initial program 78.8%

        \[\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. Add Preprocessing
      3. Taylor expanded in y around inf

        \[\leadsto \color{blue}{x \cdot \left(y \cdot z\right)} + j \cdot \left(c \cdot a - y \cdot i\right) \]
      4. Step-by-step derivation
        1. *-commutativeN/A

          \[\leadsto \color{blue}{\left(y \cdot z\right) \cdot x} + j \cdot \left(c \cdot a - y \cdot i\right) \]
        2. associate-*r*N/A

          \[\leadsto \color{blue}{y \cdot \left(z \cdot x\right)} + j \cdot \left(c \cdot a - y \cdot i\right) \]
        3. *-commutativeN/A

          \[\leadsto y \cdot \color{blue}{\left(x \cdot z\right)} + j \cdot \left(c \cdot a - y \cdot i\right) \]
        4. lower-*.f64N/A

          \[\leadsto \color{blue}{y \cdot \left(x \cdot z\right)} + j \cdot \left(c \cdot a - y \cdot i\right) \]
        5. *-commutativeN/A

          \[\leadsto y \cdot \color{blue}{\left(z \cdot x\right)} + j \cdot \left(c \cdot a - y \cdot i\right) \]
        6. lower-*.f6457.6

          \[\leadsto y \cdot \color{blue}{\left(z \cdot x\right)} + j \cdot \left(c \cdot a - y \cdot i\right) \]
      5. Applied rewrites57.6%

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

      if 3.59999999999999988e74 < t

      1. Initial program 61.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. Add Preprocessing
      3. Taylor expanded in t around inf

        \[\leadsto \color{blue}{t \cdot \left(-1 \cdot \left(a \cdot x\right) - -1 \cdot \left(b \cdot i\right)\right)} \]
      4. Step-by-step derivation
        1. lower-*.f64N/A

          \[\leadsto \color{blue}{t \cdot \left(-1 \cdot \left(a \cdot x\right) - -1 \cdot \left(b \cdot i\right)\right)} \]
        2. sub-negN/A

          \[\leadsto t \cdot \color{blue}{\left(-1 \cdot \left(a \cdot x\right) + \left(\mathsf{neg}\left(-1 \cdot \left(b \cdot i\right)\right)\right)\right)} \]
        3. mul-1-negN/A

          \[\leadsto t \cdot \left(\color{blue}{\left(\mathsf{neg}\left(a \cdot x\right)\right)} + \left(\mathsf{neg}\left(-1 \cdot \left(b \cdot i\right)\right)\right)\right) \]
        4. distribute-rgt-neg-inN/A

          \[\leadsto t \cdot \left(\color{blue}{a \cdot \left(\mathsf{neg}\left(x\right)\right)} + \left(\mathsf{neg}\left(-1 \cdot \left(b \cdot i\right)\right)\right)\right) \]
        5. mul-1-negN/A

          \[\leadsto t \cdot \left(a \cdot \color{blue}{\left(-1 \cdot x\right)} + \left(\mathsf{neg}\left(-1 \cdot \left(b \cdot i\right)\right)\right)\right) \]
        6. mul-1-negN/A

          \[\leadsto t \cdot \left(a \cdot \left(-1 \cdot x\right) + \left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(b \cdot i\right)\right)}\right)\right)\right) \]
        7. remove-double-negN/A

          \[\leadsto t \cdot \left(a \cdot \left(-1 \cdot x\right) + \color{blue}{b \cdot i}\right) \]
        8. lower-fma.f64N/A

          \[\leadsto t \cdot \color{blue}{\mathsf{fma}\left(a, -1 \cdot x, b \cdot i\right)} \]
        9. mul-1-negN/A

          \[\leadsto t \cdot \mathsf{fma}\left(a, \color{blue}{\mathsf{neg}\left(x\right)}, b \cdot i\right) \]
        10. lower-neg.f64N/A

          \[\leadsto t \cdot \mathsf{fma}\left(a, \color{blue}{\mathsf{neg}\left(x\right)}, b \cdot i\right) \]
        11. *-commutativeN/A

          \[\leadsto t \cdot \mathsf{fma}\left(a, \mathsf{neg}\left(x\right), \color{blue}{i \cdot b}\right) \]
        12. lower-*.f6465.5

          \[\leadsto t \cdot \mathsf{fma}\left(a, -x, \color{blue}{i \cdot b}\right) \]
      5. Applied rewrites65.5%

        \[\leadsto \color{blue}{t \cdot \mathsf{fma}\left(a, -x, i \cdot b\right)} \]
    8. Recombined 4 regimes into one program.
    9. Final simplification60.1%

      \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -8.6 \cdot 10^{+15}:\\ \;\;\;\;\mathsf{fma}\left(j, a \cdot c, t \cdot \mathsf{fma}\left(a, -x, b \cdot i\right)\right)\\ \mathbf{elif}\;t \leq -3.6 \cdot 10^{-147}:\\ \;\;\;\;j \cdot \left(a \cdot c - y \cdot i\right) + t \cdot \left(b \cdot i\right)\\ \mathbf{elif}\;t \leq 3.6 \cdot 10^{+74}:\\ \;\;\;\;j \cdot \left(a \cdot c - y \cdot i\right) + y \cdot \left(x \cdot z\right)\\ \mathbf{else}:\\ \;\;\;\;t \cdot \mathsf{fma}\left(a, -x, b \cdot i\right)\\ \end{array} \]
    10. Add Preprocessing

    Developer Target 1: 60.0% accurate, 0.2× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} t_1 := j \cdot \left(c \cdot a - y \cdot i\right)\\ t_2 := \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) + t\_1\\ \mathbf{if}\;x < -1.469694296777705 \cdot 10^{-64}:\\ \;\;\;\;t\_2\\ \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) - t\_1\right)\\ \mathbf{else}:\\ \;\;\;\;t\_2\\ \end{array} \end{array} \]
    (FPCore (x y z t a b c i j)
     :precision binary64
     (let* ((t_1 (* j (- (* c a) (* y i))))
            (t_2
             (+
              (-
               (* x (- (* y z) (* t a)))
               (/
                (* b (- (pow (* c z) 2.0) (pow (* t i) 2.0)))
                (+ (* c z) (* t i))))
              t_1)))
       (if (< x -1.469694296777705e-64)
         t_2
         (if (< x 3.2113527362226803e-147)
           (- (* (- (* b i) (* x a)) t) (- (* z (* c b)) t_1))
           t_2))))
    double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
    	double t_1 = j * ((c * a) - (y * i));
    	double t_2 = ((x * ((y * z) - (t * a))) - ((b * (pow((c * z), 2.0) - pow((t * i), 2.0))) / ((c * z) + (t * i)))) + t_1;
    	double tmp;
    	if (x < -1.469694296777705e-64) {
    		tmp = t_2;
    	} else if (x < 3.2113527362226803e-147) {
    		tmp = (((b * i) - (x * a)) * t) - ((z * (c * b)) - t_1);
    	} else {
    		tmp = t_2;
    	}
    	return tmp;
    }
    
    real(8) function code(x, y, z, t, a, b, c, i, j)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        real(8), intent (in) :: z
        real(8), intent (in) :: t
        real(8), intent (in) :: a
        real(8), intent (in) :: b
        real(8), intent (in) :: c
        real(8), intent (in) :: i
        real(8), intent (in) :: j
        real(8) :: t_1
        real(8) :: t_2
        real(8) :: tmp
        t_1 = j * ((c * a) - (y * i))
        t_2 = ((x * ((y * z) - (t * a))) - ((b * (((c * z) ** 2.0d0) - ((t * i) ** 2.0d0))) / ((c * z) + (t * i)))) + t_1
        if (x < (-1.469694296777705d-64)) then
            tmp = t_2
        else if (x < 3.2113527362226803d-147) then
            tmp = (((b * i) - (x * a)) * t) - ((z * (c * b)) - t_1)
        else
            tmp = t_2
        end if
        code = tmp
    end function
    
    public static double code(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
    	double t_1 = j * ((c * a) - (y * i));
    	double t_2 = ((x * ((y * z) - (t * a))) - ((b * (Math.pow((c * z), 2.0) - Math.pow((t * i), 2.0))) / ((c * z) + (t * i)))) + t_1;
    	double tmp;
    	if (x < -1.469694296777705e-64) {
    		tmp = t_2;
    	} else if (x < 3.2113527362226803e-147) {
    		tmp = (((b * i) - (x * a)) * t) - ((z * (c * b)) - t_1);
    	} else {
    		tmp = t_2;
    	}
    	return tmp;
    }
    
    def code(x, y, z, t, a, b, c, i, j):
    	t_1 = j * ((c * a) - (y * i))
    	t_2 = ((x * ((y * z) - (t * a))) - ((b * (math.pow((c * z), 2.0) - math.pow((t * i), 2.0))) / ((c * z) + (t * i)))) + t_1
    	tmp = 0
    	if x < -1.469694296777705e-64:
    		tmp = t_2
    	elif x < 3.2113527362226803e-147:
    		tmp = (((b * i) - (x * a)) * t) - ((z * (c * b)) - t_1)
    	else:
    		tmp = t_2
    	return tmp
    
    function code(x, y, z, t, a, b, c, i, j)
    	t_1 = Float64(j * Float64(Float64(c * a) - Float64(y * i)))
    	t_2 = Float64(Float64(Float64(x * Float64(Float64(y * z) - Float64(t * a))) - Float64(Float64(b * Float64((Float64(c * z) ^ 2.0) - (Float64(t * i) ^ 2.0))) / Float64(Float64(c * z) + Float64(t * i)))) + t_1)
    	tmp = 0.0
    	if (x < -1.469694296777705e-64)
    		tmp = t_2;
    	elseif (x < 3.2113527362226803e-147)
    		tmp = Float64(Float64(Float64(Float64(b * i) - Float64(x * a)) * t) - Float64(Float64(z * Float64(c * b)) - t_1));
    	else
    		tmp = t_2;
    	end
    	return tmp
    end
    
    function tmp_2 = code(x, y, z, t, a, b, c, i, j)
    	t_1 = j * ((c * a) - (y * i));
    	t_2 = ((x * ((y * z) - (t * a))) - ((b * (((c * z) ^ 2.0) - ((t * i) ^ 2.0))) / ((c * z) + (t * i)))) + t_1;
    	tmp = 0.0;
    	if (x < -1.469694296777705e-64)
    		tmp = t_2;
    	elseif (x < 3.2113527362226803e-147)
    		tmp = (((b * i) - (x * a)) * t) - ((z * (c * b)) - t_1);
    	else
    		tmp = t_2;
    	end
    	tmp_2 = tmp;
    end
    
    code[x_, y_, z_, t_, a_, b_, c_, i_, j_] := Block[{t$95$1 = N[(j * N[(N[(c * a), $MachinePrecision] - N[(y * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(x * N[(N[(y * z), $MachinePrecision] - N[(t * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(b * N[(N[Power[N[(c * z), $MachinePrecision], 2.0], $MachinePrecision] - N[Power[N[(t * i), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(c * z), $MachinePrecision] + N[(t * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision]}, If[Less[x, -1.469694296777705e-64], t$95$2, If[Less[x, 3.2113527362226803e-147], N[(N[(N[(N[(b * i), $MachinePrecision] - N[(x * a), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision] - N[(N[(z * N[(c * b), $MachinePrecision]), $MachinePrecision] - t$95$1), $MachinePrecision]), $MachinePrecision], t$95$2]]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    t_1 := j \cdot \left(c \cdot a - y \cdot i\right)\\
    t_2 := \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) + t\_1\\
    \mathbf{if}\;x < -1.469694296777705 \cdot 10^{-64}:\\
    \;\;\;\;t\_2\\
    
    \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) - t\_1\right)\\
    
    \mathbf{else}:\\
    \;\;\;\;t\_2\\
    
    
    \end{array}
    \end{array}
    

    Reproduce

    ?
    herbie shell --seed 2024229 
    (FPCore (x y z t a b c i j)
      :name "Data.Colour.Matrix:determinant from colour-2.3.3, A"
      :precision binary64
    
      :alt
      (! :herbie-platform default (if (< x -293938859355541/2000000000000000000000000000000000000000000000000000000000000000000000000000000) (+ (- (* x (- (* y z) (* t a))) (/ (* b (- (pow (* c z) 2) (pow (* t i) 2))) (+ (* c z) (* t i)))) (* j (- (* c a) (* y i)))) (if (< x 32113527362226803/10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (- (* (- (* b i) (* x a)) t) (- (* z (* c b)) (* j (- (* c a) (* y i))))) (+ (- (* x (- (* y z) (* t a))) (/ (* b (- (pow (* c z) 2) (pow (* t i) 2))) (+ (* c z) (* t i)))) (* j (- (* c a) (* y i)))))))
    
      (+ (- (* x (- (* y z) (* t a))) (* b (- (* c z) (* t i)))) (* j (- (* c a) (* y i)))))