Average Error: 12.0 → 12.4
Time: 6.5s
Precision: 64
\[\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} \mathbf{if}\;x \le 1.6227582129164173 \cdot 10^{-284}:\\ \;\;\;\;\left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - t \cdot i\right)\right) + \frac{1}{\frac{1}{j \cdot \left(c \cdot a - i \cdot y\right) + j \cdot \mathsf{fma}\left(-i, y, i \cdot y\right)}}\\ \mathbf{elif}\;x \le 5.64284305689208109 \cdot 10^{-266}:\\ \;\;\;\;\mathsf{fma}\left(t, i \cdot b, -\mathsf{fma}\left(z, b \cdot c, t \cdot \left(x \cdot a\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - t \cdot i\right)\right) + \frac{j}{\frac{1}{\mathsf{fma}\left(a, c, -y \cdot i\right)}}\\ \end{array}\]
\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}
\mathbf{if}\;x \le 1.6227582129164173 \cdot 10^{-284}:\\
\;\;\;\;\left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - t \cdot i\right)\right) + \frac{1}{\frac{1}{j \cdot \left(c \cdot a - i \cdot y\right) + j \cdot \mathsf{fma}\left(-i, y, i \cdot y\right)}}\\

\mathbf{elif}\;x \le 5.64284305689208109 \cdot 10^{-266}:\\
\;\;\;\;\mathsf{fma}\left(t, i \cdot b, -\mathsf{fma}\left(z, b \cdot c, t \cdot \left(x \cdot a\right)\right)\right)\\

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

\end{array}
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 VAR;
	if ((x <= 1.6227582129164173e-284)) {
		VAR = (((x * ((y * z) - (t * a))) - (b * ((c * z) - (t * i)))) + (1.0 / (1.0 / ((j * ((c * a) - (i * y))) + (j * fma(-i, y, (i * y)))))));
	} else {
		double VAR_1;
		if ((x <= 5.642843056892081e-266)) {
			VAR_1 = fma(t, (i * b), -fma(z, (b * c), (t * (x * a))));
		} else {
			VAR_1 = (((x * ((y * z) - (t * a))) - (b * ((c * z) - (t * i)))) + (j / (1.0 / fma(a, c, -(y * i)))));
		}
		VAR = VAR_1;
	}
	return VAR;
}

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

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original12.0
Target19.6
Herbie12.4
\[\begin{array}{l} \mathbf{if}\;x \lt -1.46969429677770502 \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 \lt 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 3 regimes
  2. if x < 1.6227582129164173e-284

    1. Initial program 12.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. Using strategy rm
    3. Applied flip--25.3

      \[\leadsto \left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - t \cdot i\right)\right) + j \cdot \color{blue}{\frac{\left(c \cdot a\right) \cdot \left(c \cdot a\right) - \left(y \cdot i\right) \cdot \left(y \cdot i\right)}{c \cdot a + y \cdot i}}\]
    4. Applied associate-*r/27.8

      \[\leadsto \left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - t \cdot i\right)\right) + \color{blue}{\frac{j \cdot \left(\left(c \cdot a\right) \cdot \left(c \cdot a\right) - \left(y \cdot i\right) \cdot \left(y \cdot i\right)\right)}{c \cdot a + y \cdot i}}\]
    5. Simplified23.0

      \[\leadsto \left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - t \cdot i\right)\right) + \frac{\color{blue}{\left(j \cdot \mathsf{fma}\left(a, c, i \cdot y\right)\right) \cdot \mathsf{fma}\left(a, c, -y \cdot i\right)}}{c \cdot a + y \cdot i}\]
    6. Using strategy rm
    7. Applied clear-num23.0

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

      \[\leadsto \left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - t \cdot i\right)\right) + \frac{1}{\color{blue}{\frac{1}{j \cdot \left(c \cdot a - i \cdot y\right)}}}\]
    9. Using strategy rm
    10. Applied prod-diff12.6

      \[\leadsto \left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - t \cdot i\right)\right) + \frac{1}{\frac{1}{j \cdot \color{blue}{\left(\mathsf{fma}\left(c, a, -y \cdot i\right) + \mathsf{fma}\left(-y, i, y \cdot i\right)\right)}}}\]
    11. Applied distribute-lft-in12.6

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

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

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

    if 1.6227582129164173e-284 < x < 5.642843056892081e-266

    1. Initial program 14.5

      \[\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. Simplified14.5

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

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

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

    if 5.642843056892081e-266 < x

    1. Initial program 11.2

      \[\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. Using strategy rm
    3. Applied flip--23.5

      \[\leadsto \left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - t \cdot i\right)\right) + j \cdot \color{blue}{\frac{\left(c \cdot a\right) \cdot \left(c \cdot a\right) - \left(y \cdot i\right) \cdot \left(y \cdot i\right)}{c \cdot a + y \cdot i}}\]
    4. Applied associate-*r/25.8

      \[\leadsto \left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - t \cdot i\right)\right) + \color{blue}{\frac{j \cdot \left(\left(c \cdot a\right) \cdot \left(c \cdot a\right) - \left(y \cdot i\right) \cdot \left(y \cdot i\right)\right)}{c \cdot a + y \cdot i}}\]
    5. Simplified21.0

      \[\leadsto \left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - t \cdot i\right)\right) + \frac{\color{blue}{\left(j \cdot \mathsf{fma}\left(a, c, i \cdot y\right)\right) \cdot \mathsf{fma}\left(a, c, -y \cdot i\right)}}{c \cdot a + y \cdot i}\]
    6. Using strategy rm
    7. Applied associate-*l*25.8

      \[\leadsto \left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - t \cdot i\right)\right) + \frac{\color{blue}{j \cdot \left(\mathsf{fma}\left(a, c, i \cdot y\right) \cdot \mathsf{fma}\left(a, c, -y \cdot i\right)\right)}}{c \cdot a + y \cdot i}\]
    8. Applied associate-/l*23.5

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le 1.6227582129164173 \cdot 10^{-284}:\\ \;\;\;\;\left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - t \cdot i\right)\right) + \frac{1}{\frac{1}{j \cdot \left(c \cdot a - i \cdot y\right) + j \cdot \mathsf{fma}\left(-i, y, i \cdot y\right)}}\\ \mathbf{elif}\;x \le 5.64284305689208109 \cdot 10^{-266}:\\ \;\;\;\;\mathsf{fma}\left(t, i \cdot b, -\mathsf{fma}\left(z, b \cdot c, t \cdot \left(x \cdot a\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - t \cdot i\right)\right) + \frac{j}{\frac{1}{\mathsf{fma}\left(a, c, -y \cdot i\right)}}\\ \end{array}\]

Reproduce

herbie shell --seed 2020071 +o rules:numerics
(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) (pow (* t i) 2))) (+ (* 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) (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)))))