Average Error: 11.9 → 10.1
Time: 15.2s
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}\;y \le -8.1300574890867429 \cdot 10^{98} \lor \neg \left(y \le 2.4703080645164388 \cdot 10^{126}\right):\\ \;\;\;\;\mathsf{fma}\left(t \cdot i - c \cdot z, b, y \cdot \left(x \cdot z - i \cdot j\right) - t \cdot \left(x \cdot a\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(t \cdot i - c \cdot z, b, \mathsf{fma}\left(j, c \cdot a - y \cdot i, \left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right) \cdot \left(\mathsf{fma}\left(z, y, \left(-a\right) \cdot t\right) \cdot \sqrt[3]{x}\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}\;y \le -8.1300574890867429 \cdot 10^{98} \lor \neg \left(y \le 2.4703080645164388 \cdot 10^{126}\right):\\
\;\;\;\;\mathsf{fma}\left(t \cdot i - c \cdot z, b, y \cdot \left(x \cdot z - i \cdot j\right) - t \cdot \left(x \cdot a\right)\right)\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t \cdot i - c \cdot z, b, \mathsf{fma}\left(j, c \cdot a - y \cdot i, \left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right) \cdot \left(\mathsf{fma}\left(z, y, \left(-a\right) \cdot t\right) \cdot \sqrt[3]{x}\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 r944330 = x;
        double r944331 = y;
        double r944332 = z;
        double r944333 = r944331 * r944332;
        double r944334 = t;
        double r944335 = a;
        double r944336 = r944334 * r944335;
        double r944337 = r944333 - r944336;
        double r944338 = r944330 * r944337;
        double r944339 = b;
        double r944340 = c;
        double r944341 = r944340 * r944332;
        double r944342 = i;
        double r944343 = r944334 * r944342;
        double r944344 = r944341 - r944343;
        double r944345 = r944339 * r944344;
        double r944346 = r944338 - r944345;
        double r944347 = j;
        double r944348 = r944340 * r944335;
        double r944349 = r944331 * r944342;
        double r944350 = r944348 - r944349;
        double r944351 = r944347 * r944350;
        double r944352 = r944346 + r944351;
        return r944352;
}

double f(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
        double r944353 = y;
        double r944354 = -8.130057489086743e+98;
        bool r944355 = r944353 <= r944354;
        double r944356 = 2.4703080645164388e+126;
        bool r944357 = r944353 <= r944356;
        double r944358 = !r944357;
        bool r944359 = r944355 || r944358;
        double r944360 = t;
        double r944361 = i;
        double r944362 = r944360 * r944361;
        double r944363 = c;
        double r944364 = z;
        double r944365 = r944363 * r944364;
        double r944366 = r944362 - r944365;
        double r944367 = b;
        double r944368 = x;
        double r944369 = r944368 * r944364;
        double r944370 = j;
        double r944371 = r944361 * r944370;
        double r944372 = r944369 - r944371;
        double r944373 = r944353 * r944372;
        double r944374 = a;
        double r944375 = r944368 * r944374;
        double r944376 = r944360 * r944375;
        double r944377 = r944373 - r944376;
        double r944378 = fma(r944366, r944367, r944377);
        double r944379 = r944363 * r944374;
        double r944380 = r944353 * r944361;
        double r944381 = r944379 - r944380;
        double r944382 = cbrt(r944368);
        double r944383 = r944382 * r944382;
        double r944384 = -r944374;
        double r944385 = r944384 * r944360;
        double r944386 = fma(r944364, r944353, r944385);
        double r944387 = r944386 * r944382;
        double r944388 = r944383 * r944387;
        double r944389 = fma(r944370, r944381, r944388);
        double r944390 = fma(r944366, r944367, r944389);
        double r944391 = r944359 ? r944378 : r944390;
        return r944391;
}

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.9
Target19.8
Herbie10.1
\[\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 2 regimes
  2. if y < -8.130057489086743e+98 or 2.4703080645164388e+126 < y

    1. Initial program 21.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. Simplified21.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. Using strategy rm
    4. Applied prod-diff21.4

      \[\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(\mathsf{fma}\left(y, z, -a \cdot t\right) + \mathsf{fma}\left(-a, t, a \cdot t\right)\right)}\right)\right)\]
    5. Simplified21.4

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

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

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

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

      \[\leadsto \mathsf{fma}\left(t \cdot i - c \cdot z, b, \mathsf{fma}\left(j, c \cdot a - y \cdot i, \left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right) \cdot \color{blue}{\left(\left(0 + \mathsf{fma}\left(z, y, \left(-a\right) \cdot t\right)\right) \cdot \sqrt[3]{x}\right)}\right)\right)\]
    11. Taylor expanded around inf 23.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)\]
    12. Simplified11.7

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

    if -8.130057489086743e+98 < y < 2.4703080645164388e+126

    1. Initial program 9.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. Simplified9.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. Using strategy rm
    4. Applied prod-diff9.4

      \[\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(\mathsf{fma}\left(y, z, -a \cdot t\right) + \mathsf{fma}\left(-a, t, a \cdot t\right)\right)}\right)\right)\]
    5. Simplified9.4

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \le -8.1300574890867429 \cdot 10^{98} \lor \neg \left(y \le 2.4703080645164388 \cdot 10^{126}\right):\\ \;\;\;\;\mathsf{fma}\left(t \cdot i - c \cdot z, b, y \cdot \left(x \cdot z - i \cdot j\right) - t \cdot \left(x \cdot a\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(t \cdot i - c \cdot z, b, \mathsf{fma}\left(j, c \cdot a - y \cdot i, \left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right) \cdot \left(\mathsf{fma}\left(z, y, \left(-a\right) \cdot t\right) \cdot \sqrt[3]{x}\right)\right)\right)\\ \end{array}\]

Reproduce

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