Average Error: 11.8 → 11.7
Time: 20.1s
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}\;i \le -8.43354046851160416 \cdot 10^{193}:\\ \;\;\;\;\mathsf{fma}\left(t \cdot i - c \cdot z, b, x \cdot \left(y \cdot z - t \cdot a\right) - i \cdot \left(y \cdot j\right)\right)\\ \mathbf{elif}\;i \le -5.49305527471651 \cdot 10^{24} \lor \neg \left(i \le -1.23326924392944711 \cdot 10^{-82}\right) \land i \le 3.51256697894384232 \cdot 10^{-19}:\\ \;\;\;\;\mathsf{fma}\left(t \cdot i - c \cdot z, b, \mathsf{fma}\left(j, c \cdot a - y \cdot i, \left(x \cdot z\right) \cdot y + x \cdot \left(-t \cdot a\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(t \cdot i - c \cdot z, b, \mathsf{fma}\left(j, c \cdot a - y \cdot i, x \cdot \left(z \cdot y\right) + \left(x \cdot t\right) \cdot \left(-a\right)\right)\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}\;i \le -8.43354046851160416 \cdot 10^{193}:\\
\;\;\;\;\mathsf{fma}\left(t \cdot i - c \cdot z, b, x \cdot \left(y \cdot z - t \cdot a\right) - i \cdot \left(y \cdot j\right)\right)\\

\mathbf{elif}\;i \le -5.49305527471651 \cdot 10^{24} \lor \neg \left(i \le -1.23326924392944711 \cdot 10^{-82}\right) \land i \le 3.51256697894384232 \cdot 10^{-19}:\\
\;\;\;\;\mathsf{fma}\left(t \cdot i - c \cdot z, b, \mathsf{fma}\left(j, c \cdot a - y \cdot i, \left(x \cdot z\right) \cdot y + x \cdot \left(-t \cdot a\right)\right)\right)\\

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

\end{array}
double f(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
        double r973172 = x;
        double r973173 = y;
        double r973174 = z;
        double r973175 = r973173 * r973174;
        double r973176 = t;
        double r973177 = a;
        double r973178 = r973176 * r973177;
        double r973179 = r973175 - r973178;
        double r973180 = r973172 * r973179;
        double r973181 = b;
        double r973182 = c;
        double r973183 = r973182 * r973174;
        double r973184 = i;
        double r973185 = r973176 * r973184;
        double r973186 = r973183 - r973185;
        double r973187 = r973181 * r973186;
        double r973188 = r973180 - r973187;
        double r973189 = j;
        double r973190 = r973182 * r973177;
        double r973191 = r973173 * r973184;
        double r973192 = r973190 - r973191;
        double r973193 = r973189 * r973192;
        double r973194 = r973188 + r973193;
        return r973194;
}

double f(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
        double r973195 = i;
        double r973196 = -8.433540468511604e+193;
        bool r973197 = r973195 <= r973196;
        double r973198 = t;
        double r973199 = r973198 * r973195;
        double r973200 = c;
        double r973201 = z;
        double r973202 = r973200 * r973201;
        double r973203 = r973199 - r973202;
        double r973204 = b;
        double r973205 = x;
        double r973206 = y;
        double r973207 = r973206 * r973201;
        double r973208 = a;
        double r973209 = r973198 * r973208;
        double r973210 = r973207 - r973209;
        double r973211 = r973205 * r973210;
        double r973212 = j;
        double r973213 = r973206 * r973212;
        double r973214 = r973195 * r973213;
        double r973215 = r973211 - r973214;
        double r973216 = fma(r973203, r973204, r973215);
        double r973217 = -5.493055274716507e+24;
        bool r973218 = r973195 <= r973217;
        double r973219 = -1.2332692439294471e-82;
        bool r973220 = r973195 <= r973219;
        double r973221 = !r973220;
        double r973222 = 3.5125669789438423e-19;
        bool r973223 = r973195 <= r973222;
        bool r973224 = r973221 && r973223;
        bool r973225 = r973218 || r973224;
        double r973226 = r973200 * r973208;
        double r973227 = r973206 * r973195;
        double r973228 = r973226 - r973227;
        double r973229 = r973205 * r973201;
        double r973230 = r973229 * r973206;
        double r973231 = -r973209;
        double r973232 = r973205 * r973231;
        double r973233 = r973230 + r973232;
        double r973234 = fma(r973212, r973228, r973233);
        double r973235 = fma(r973203, r973204, r973234);
        double r973236 = r973201 * r973206;
        double r973237 = r973205 * r973236;
        double r973238 = r973205 * r973198;
        double r973239 = -r973208;
        double r973240 = r973238 * r973239;
        double r973241 = r973237 + r973240;
        double r973242 = fma(r973212, r973228, r973241);
        double r973243 = fma(r973203, r973204, r973242);
        double r973244 = r973225 ? r973235 : r973243;
        double r973245 = r973197 ? r973216 : r973244;
        return r973245;
}

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

Original11.8
Target19.8
Herbie11.7
\[\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 i < -8.433540468511604e+193

    1. Initial program 26.4

      \[\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. Simplified26.4

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

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

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

    if -8.433540468511604e+193 < i < -5.493055274716507e+24 or -1.2332692439294471e-82 < i < 3.5125669789438423e-19

    1. Initial program 9.9

      \[\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. Simplified9.9

      \[\leadsto \color{blue}{\mathsf{fma}\left(t \cdot i - c \cdot z, b, \mathsf{fma}\left(j, c \cdot a - y \cdot i, x \cdot \left(y \cdot z - t \cdot a\right)\right)\right)}\]
    3. Using strategy rm
    4. Applied sub-neg9.9

      \[\leadsto \mathsf{fma}\left(t \cdot i - c \cdot z, b, \mathsf{fma}\left(j, c \cdot a - y \cdot i, x \cdot \color{blue}{\left(y \cdot z + \left(-t \cdot a\right)\right)}\right)\right)\]
    5. Applied distribute-lft-in9.9

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

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

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

    if -5.493055274716507e+24 < i < -1.2332692439294471e-82 or 3.5125669789438423e-19 < i

    1. Initial program 13.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. Simplified13.1

      \[\leadsto \color{blue}{\mathsf{fma}\left(t \cdot i - c \cdot z, b, \mathsf{fma}\left(j, c \cdot a - y \cdot i, x \cdot \left(y \cdot z - t \cdot a\right)\right)\right)}\]
    3. Using strategy rm
    4. Applied sub-neg13.1

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

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

      \[\leadsto \mathsf{fma}\left(t \cdot i - c \cdot z, b, \mathsf{fma}\left(j, c \cdot a - y \cdot i, \color{blue}{x \cdot \left(z \cdot y\right)} + x \cdot \left(-t \cdot a\right)\right)\right)\]
    7. Using strategy rm
    8. Applied distribute-rgt-neg-in13.1

      \[\leadsto \mathsf{fma}\left(t \cdot i - c \cdot z, b, \mathsf{fma}\left(j, c \cdot a - y \cdot i, x \cdot \left(z \cdot y\right) + x \cdot \color{blue}{\left(t \cdot \left(-a\right)\right)}\right)\right)\]
    9. Applied associate-*r*13.1

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;i \le -8.43354046851160416 \cdot 10^{193}:\\ \;\;\;\;\mathsf{fma}\left(t \cdot i - c \cdot z, b, x \cdot \left(y \cdot z - t \cdot a\right) - i \cdot \left(y \cdot j\right)\right)\\ \mathbf{elif}\;i \le -5.49305527471651 \cdot 10^{24} \lor \neg \left(i \le -1.23326924392944711 \cdot 10^{-82}\right) \land i \le 3.51256697894384232 \cdot 10^{-19}:\\ \;\;\;\;\mathsf{fma}\left(t \cdot i - c \cdot z, b, \mathsf{fma}\left(j, c \cdot a - y \cdot i, \left(x \cdot z\right) \cdot y + x \cdot \left(-t \cdot a\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(t \cdot i - c \cdot z, b, \mathsf{fma}\left(j, c \cdot a - y \cdot i, x \cdot \left(z \cdot y\right) + \left(x \cdot t\right) \cdot \left(-a\right)\right)\right)\\ \end{array}\]

Reproduce

herbie shell --seed 2020042 +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)))))