Average Error: 11.9 → 11.8
Time: 20.7s
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}\;t \le -1.60161171119782911 \cdot 10^{230}:\\ \;\;\;\;\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}:\\ \;\;\;\;\mathsf{fma}\left(c \cdot a - y \cdot i, j, \left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right) \cdot \left(\sqrt[3]{x} \cdot \mathsf{fma}\left(y, z, -a \cdot t\right)\right) - \left(b \cdot \left(c \cdot z - t \cdot i\right) + b \cdot \mathsf{fma}\left(-i, t, i \cdot t\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}\;t \le -1.60161171119782911 \cdot 10^{230}:\\
\;\;\;\;\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}:\\
\;\;\;\;\mathsf{fma}\left(c \cdot a - y \cdot i, j, \left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right) \cdot \left(\sqrt[3]{x} \cdot \mathsf{fma}\left(y, z, -a \cdot t\right)\right) - \left(b \cdot \left(c \cdot z - t \cdot i\right) + b \cdot \mathsf{fma}\left(-i, t, i \cdot t\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 r938141 = x;
        double r938142 = y;
        double r938143 = z;
        double r938144 = r938142 * r938143;
        double r938145 = t;
        double r938146 = a;
        double r938147 = r938145 * r938146;
        double r938148 = r938144 - r938147;
        double r938149 = r938141 * r938148;
        double r938150 = b;
        double r938151 = c;
        double r938152 = r938151 * r938143;
        double r938153 = i;
        double r938154 = r938145 * r938153;
        double r938155 = r938152 - r938154;
        double r938156 = r938150 * r938155;
        double r938157 = r938149 - r938156;
        double r938158 = j;
        double r938159 = r938151 * r938146;
        double r938160 = r938142 * r938153;
        double r938161 = r938159 - r938160;
        double r938162 = r938158 * r938161;
        double r938163 = r938157 + r938162;
        return r938163;
}

double f(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
        double r938164 = t;
        double r938165 = -1.6016117111978291e+230;
        bool r938166 = r938164 <= r938165;
        double r938167 = i;
        double r938168 = b;
        double r938169 = r938167 * r938168;
        double r938170 = z;
        double r938171 = c;
        double r938172 = r938168 * r938171;
        double r938173 = x;
        double r938174 = a;
        double r938175 = r938173 * r938174;
        double r938176 = r938164 * r938175;
        double r938177 = fma(r938170, r938172, r938176);
        double r938178 = -r938177;
        double r938179 = fma(r938164, r938169, r938178);
        double r938180 = r938171 * r938174;
        double r938181 = y;
        double r938182 = r938181 * r938167;
        double r938183 = r938180 - r938182;
        double r938184 = j;
        double r938185 = cbrt(r938173);
        double r938186 = r938185 * r938185;
        double r938187 = r938174 * r938164;
        double r938188 = -r938187;
        double r938189 = fma(r938181, r938170, r938188);
        double r938190 = r938185 * r938189;
        double r938191 = r938186 * r938190;
        double r938192 = r938171 * r938170;
        double r938193 = r938164 * r938167;
        double r938194 = r938192 - r938193;
        double r938195 = r938168 * r938194;
        double r938196 = -r938167;
        double r938197 = r938167 * r938164;
        double r938198 = fma(r938196, r938164, r938197);
        double r938199 = r938168 * r938198;
        double r938200 = r938195 + r938199;
        double r938201 = r938191 - r938200;
        double r938202 = fma(r938183, r938184, r938201);
        double r938203 = r938166 ? r938179 : r938202;
        return r938203;
}

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
Herbie11.8
\[\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 t < -1.6016117111978291e+230

    1. Initial program 27.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. Simplified27.2

      \[\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 18.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. Simplified18.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 -1.6016117111978291e+230 < t

    1. Initial program 11.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. Simplified11.4

      \[\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. Using strategy rm
    4. Applied prod-diff11.4

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \le -1.60161171119782911 \cdot 10^{230}:\\ \;\;\;\;\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}:\\ \;\;\;\;\mathsf{fma}\left(c \cdot a - y \cdot i, j, \left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right) \cdot \left(\sqrt[3]{x} \cdot \mathsf{fma}\left(y, z, -a \cdot t\right)\right) - \left(b \cdot \left(c \cdot z - t \cdot i\right) + b \cdot \mathsf{fma}\left(-i, t, i \cdot t\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)))))