Average Error: 12.0 → 4.4
Time: 13.6s
Precision: binary64
\[\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 := b \cdot \left(a \cdot i - z \cdot c\right)\\ t_2 := y \cdot z - t \cdot a\\ t_3 := \left(x \cdot t_2 + t_1\right) + j \cdot \left(t \cdot c - y \cdot i\right)\\ \mathbf{if}\;t_3 \leq -\infty:\\ \;\;\;\;\mathsf{fma}\left(z, x \cdot y - b \cdot c, t \cdot \left(c \cdot j - x \cdot a\right)\right)\\ \mathbf{elif}\;t_3 \leq 2.3370763078724267 \cdot 10^{+294}:\\ \;\;\;\;\mathsf{fma}\left(x, t_2, \mathsf{fma}\left(j, \mathsf{fma}\left(1, t \cdot c, y \cdot \left(-i\right)\right), t_1\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(y, x \cdot z - i \cdot j, c \cdot \left(t \cdot j - z \cdot b\right)\right) + a \cdot \mathsf{fma}\left(i, b, x \cdot \left(-t\right)\right)\\ \end{array} \]
(FPCore (x y z t a b c i j)
 :precision binary64
 (+
  (- (* x (- (* y z) (* t a))) (* b (- (* c z) (* i a))))
  (* j (- (* c t) (* i y)))))
(FPCore (x y z t a b c i j)
 :precision binary64
 (let* ((t_1 (* b (- (* a i) (* z c))))
        (t_2 (- (* y z) (* t a)))
        (t_3 (+ (+ (* x t_2) t_1) (* j (- (* t c) (* y i))))))
   (if (<= t_3 (- INFINITY))
     (fma z (- (* x y) (* b c)) (* t (- (* c j) (* x a))))
     (if (<= t_3 2.3370763078724267e+294)
       (fma x t_2 (fma j (fma 1.0 (* t c) (* y (- i))) t_1))
       (+
        (fma y (- (* x z) (* i j)) (* c (- (* t j) (* z b))))
        (* a (fma i b (* x (- t)))))))))
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 = b * ((a * i) - (z * c));
	double t_2 = (y * z) - (t * a);
	double t_3 = ((x * t_2) + t_1) + (j * ((t * c) - (y * i)));
	double tmp;
	if (t_3 <= -((double) INFINITY)) {
		tmp = fma(z, ((x * y) - (b * c)), (t * ((c * j) - (x * a))));
	} else if (t_3 <= 2.3370763078724267e+294) {
		tmp = fma(x, t_2, fma(j, fma(1.0, (t * c), (y * -i)), t_1));
	} else {
		tmp = fma(y, ((x * z) - (i * j)), (c * ((t * j) - (z * b)))) + (a * fma(i, b, (x * -t)));
	}
	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(b * Float64(Float64(a * i) - Float64(z * c)))
	t_2 = Float64(Float64(y * z) - Float64(t * a))
	t_3 = Float64(Float64(Float64(x * t_2) + t_1) + Float64(j * Float64(Float64(t * c) - Float64(y * i))))
	tmp = 0.0
	if (t_3 <= Float64(-Inf))
		tmp = fma(z, Float64(Float64(x * y) - Float64(b * c)), Float64(t * Float64(Float64(c * j) - Float64(x * a))));
	elseif (t_3 <= 2.3370763078724267e+294)
		tmp = fma(x, t_2, fma(j, fma(1.0, Float64(t * c), Float64(y * Float64(-i))), t_1));
	else
		tmp = Float64(fma(y, Float64(Float64(x * z) - Float64(i * j)), Float64(c * Float64(Float64(t * j) - Float64(z * b)))) + Float64(a * fma(i, b, Float64(x * Float64(-t)))));
	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[(b * N[(N[(a * i), $MachinePrecision] - N[(z * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(y * z), $MachinePrecision] - N[(t * a), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(N[(x * t$95$2), $MachinePrecision] + t$95$1), $MachinePrecision] + N[(j * N[(N[(t * c), $MachinePrecision] - N[(y * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$3, (-Infinity)], N[(z * N[(N[(x * y), $MachinePrecision] - N[(b * c), $MachinePrecision]), $MachinePrecision] + N[(t * N[(N[(c * j), $MachinePrecision] - N[(x * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, 2.3370763078724267e+294], N[(x * t$95$2 + N[(j * N[(1.0 * N[(t * c), $MachinePrecision] + N[(y * (-i)), $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision], N[(N[(y * N[(N[(x * z), $MachinePrecision] - N[(i * j), $MachinePrecision]), $MachinePrecision] + N[(c * N[(N[(t * j), $MachinePrecision] - N[(z * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(a * N[(i * b + N[(x * (-t)), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $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 := b \cdot \left(a \cdot i - z \cdot c\right)\\
t_2 := y \cdot z - t \cdot a\\
t_3 := \left(x \cdot t_2 + t_1\right) + j \cdot \left(t \cdot c - y \cdot i\right)\\
\mathbf{if}\;t_3 \leq -\infty:\\
\;\;\;\;\mathsf{fma}\left(z, x \cdot y - b \cdot c, t \cdot \left(c \cdot j - x \cdot a\right)\right)\\

\mathbf{elif}\;t_3 \leq 2.3370763078724267 \cdot 10^{+294}:\\
\;\;\;\;\mathsf{fma}\left(x, t_2, \mathsf{fma}\left(j, \mathsf{fma}\left(1, t \cdot c, y \cdot \left(-i\right)\right), t_1\right)\right)\\

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


\end{array}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Bits error versus a

Bits error versus b

Bits error versus c

Bits error versus i

Bits error versus j

Target

Original12.0
Target15.8
Herbie4.4
\[\begin{array}{l} \mathbf{if}\;t < -8.120978919195912 \cdot 10^{-33}:\\ \;\;\;\;x \cdot \left(z \cdot y - a \cdot t\right) - \left(b \cdot \left(z \cdot c - a \cdot i\right) - \left(c \cdot t - y \cdot i\right) \cdot j\right)\\ \mathbf{elif}\;t < -4.712553818218485 \cdot 10^{-169}:\\ \;\;\;\;\left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - i \cdot a\right)\right) + \frac{j \cdot \left({\left(c \cdot t\right)}^{2} - {\left(i \cdot y\right)}^{2}\right)}{c \cdot t + i \cdot y}\\ \mathbf{elif}\;t < -7.633533346031584 \cdot 10^{-308}:\\ \;\;\;\;x \cdot \left(z \cdot y - a \cdot t\right) - \left(b \cdot \left(z \cdot c - a \cdot i\right) - \left(c \cdot t - y \cdot i\right) \cdot j\right)\\ \mathbf{elif}\;t < 1.0535888557455487 \cdot 10^{-139}:\\ \;\;\;\;\left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - i \cdot a\right)\right) + \frac{j \cdot \left({\left(c \cdot t\right)}^{2} - {\left(i \cdot y\right)}^{2}\right)}{c \cdot t + i \cdot y}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(z \cdot y - a \cdot t\right) - \left(b \cdot \left(z \cdot c - a \cdot i\right) - \left(c \cdot t - y \cdot i\right) \cdot j\right)\\ \end{array} \]

Derivation

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

    1. Initial program 64.0

      \[\left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - i \cdot a\right)\right) + j \cdot \left(c \cdot t - i \cdot y\right) \]
    2. Simplified64.0

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

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

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

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

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

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

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

    if -inf.0 < (+.f64 (-.f64 (*.f64 x (-.f64 (*.f64 y z) (*.f64 t a))) (*.f64 b (-.f64 (*.f64 c z) (*.f64 i a)))) (*.f64 j (-.f64 (*.f64 c t) (*.f64 i y)))) < 2.33707630787242671e294

    1. Initial program 0.8

      \[\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) \]
    2. Simplified0.8

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

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

      \[\leadsto \mathsf{fma}\left(x, y \cdot z - t \cdot a, \color{blue}{\mathsf{fma}\left(j, c \cdot t - i \cdot y, b \cdot \left(i \cdot a - c \cdot z\right)\right)}\right) \]
    5. Applied egg-rr0.8

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

    if 2.33707630787242671e294 < (+.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))))

    1. Initial program 53.8

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(y, z \cdot x - i \cdot j, c \cdot \left(j \cdot t - b \cdot z\right)\right) + a \cdot \mathsf{fma}\left(i, b, t \cdot \left(-x\right)\right)} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification4.4

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

Reproduce

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