Average Error: 12.1 → 9.5
Time: 35.0s
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}\;j \le -7.67081475276466547 \cdot 10^{-70}:\\ \;\;\;\;\left(x \cdot \left(y \cdot z - t \cdot a\right) - \left(z \cdot \left(b \cdot c\right) - t \cdot \left(i \cdot b\right)\right)\right) + j \cdot \left(c \cdot a - y \cdot i\right)\\ \mathbf{elif}\;j \le 3753431522960497700:\\ \;\;\;\;\left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - t \cdot i\right)\right) + \left(a \cdot \left(j \cdot c\right) - i \cdot \left(y \cdot j\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(j, \mathsf{fma}\left(c, a, -i \cdot y\right), x \cdot \left(y \cdot z - t \cdot a\right) - \left(\sqrt[3]{b \cdot \left(c \cdot z - t \cdot i\right)} \cdot \sqrt[3]{b \cdot \left(c \cdot z - t \cdot i\right)}\right) \cdot \sqrt[3]{\left(b \cdot \left(\sqrt[3]{c \cdot z - t \cdot i} \cdot \sqrt[3]{c \cdot z - t \cdot i}\right)\right) \cdot \sqrt[3]{c \cdot z - t \cdot i}}\right) + \mathsf{fma}\left(-i, y, i \cdot y\right) \cdot j\\ \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}\;j \le -7.67081475276466547 \cdot 10^{-70}:\\
\;\;\;\;\left(x \cdot \left(y \cdot z - t \cdot a\right) - \left(z \cdot \left(b \cdot c\right) - t \cdot \left(i \cdot b\right)\right)\right) + j \cdot \left(c \cdot a - y \cdot i\right)\\

\mathbf{elif}\;j \le 3753431522960497700:\\
\;\;\;\;\left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - t \cdot i\right)\right) + \left(a \cdot \left(j \cdot c\right) - i \cdot \left(y \cdot j\right)\right)\\

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

\end{array}
double f(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
        double r546144 = x;
        double r546145 = y;
        double r546146 = z;
        double r546147 = r546145 * r546146;
        double r546148 = t;
        double r546149 = a;
        double r546150 = r546148 * r546149;
        double r546151 = r546147 - r546150;
        double r546152 = r546144 * r546151;
        double r546153 = b;
        double r546154 = c;
        double r546155 = r546154 * r546146;
        double r546156 = i;
        double r546157 = r546148 * r546156;
        double r546158 = r546155 - r546157;
        double r546159 = r546153 * r546158;
        double r546160 = r546152 - r546159;
        double r546161 = j;
        double r546162 = r546154 * r546149;
        double r546163 = r546145 * r546156;
        double r546164 = r546162 - r546163;
        double r546165 = r546161 * r546164;
        double r546166 = r546160 + r546165;
        return r546166;
}

double f(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
        double r546167 = j;
        double r546168 = -7.670814752764665e-70;
        bool r546169 = r546167 <= r546168;
        double r546170 = x;
        double r546171 = y;
        double r546172 = z;
        double r546173 = r546171 * r546172;
        double r546174 = t;
        double r546175 = a;
        double r546176 = r546174 * r546175;
        double r546177 = r546173 - r546176;
        double r546178 = r546170 * r546177;
        double r546179 = b;
        double r546180 = c;
        double r546181 = r546179 * r546180;
        double r546182 = r546172 * r546181;
        double r546183 = i;
        double r546184 = r546183 * r546179;
        double r546185 = r546174 * r546184;
        double r546186 = r546182 - r546185;
        double r546187 = r546178 - r546186;
        double r546188 = r546180 * r546175;
        double r546189 = r546171 * r546183;
        double r546190 = r546188 - r546189;
        double r546191 = r546167 * r546190;
        double r546192 = r546187 + r546191;
        double r546193 = 3.7534315229604977e+18;
        bool r546194 = r546167 <= r546193;
        double r546195 = r546180 * r546172;
        double r546196 = r546174 * r546183;
        double r546197 = r546195 - r546196;
        double r546198 = r546179 * r546197;
        double r546199 = r546178 - r546198;
        double r546200 = r546167 * r546180;
        double r546201 = r546175 * r546200;
        double r546202 = r546171 * r546167;
        double r546203 = r546183 * r546202;
        double r546204 = r546201 - r546203;
        double r546205 = r546199 + r546204;
        double r546206 = r546183 * r546171;
        double r546207 = -r546206;
        double r546208 = fma(r546180, r546175, r546207);
        double r546209 = cbrt(r546198);
        double r546210 = r546209 * r546209;
        double r546211 = cbrt(r546197);
        double r546212 = r546211 * r546211;
        double r546213 = r546179 * r546212;
        double r546214 = r546213 * r546211;
        double r546215 = cbrt(r546214);
        double r546216 = r546210 * r546215;
        double r546217 = r546178 - r546216;
        double r546218 = fma(r546167, r546208, r546217);
        double r546219 = -r546183;
        double r546220 = fma(r546219, r546171, r546206);
        double r546221 = r546220 * r546167;
        double r546222 = r546218 + r546221;
        double r546223 = r546194 ? r546205 : r546222;
        double r546224 = r546169 ? r546192 : r546223;
        return r546224;
}

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.1
Target19.5
Herbie9.5
\[\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 j < -7.670814752764665e-70

    1. Initial program 8.3

      \[\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. Taylor expanded around inf 8.8

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

    if -7.670814752764665e-70 < j < 3.7534315229604977e+18

    1. Initial program 15.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. Taylor expanded around inf 10.6

      \[\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}{\left(a \cdot \left(j \cdot c\right) - i \cdot \left(y \cdot j\right)\right)}\]

    if 3.7534315229604977e+18 < j

    1. Initial program 7.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 prod-diff7.2

      \[\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}{\left(\mathsf{fma}\left(c, a, -i \cdot y\right) + \mathsf{fma}\left(-i, y, i \cdot y\right)\right)}\]
    4. Applied distribute-rgt-in7.2

      \[\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}{\left(\mathsf{fma}\left(c, a, -i \cdot y\right) \cdot j + \mathsf{fma}\left(-i, y, i \cdot y\right) \cdot j\right)}\]
    5. Applied associate-+r+7.2

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;j \le -7.67081475276466547 \cdot 10^{-70}:\\ \;\;\;\;\left(x \cdot \left(y \cdot z - t \cdot a\right) - \left(z \cdot \left(b \cdot c\right) - t \cdot \left(i \cdot b\right)\right)\right) + j \cdot \left(c \cdot a - y \cdot i\right)\\ \mathbf{elif}\;j \le 3753431522960497700:\\ \;\;\;\;\left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - t \cdot i\right)\right) + \left(a \cdot \left(j \cdot c\right) - i \cdot \left(y \cdot j\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(j, \mathsf{fma}\left(c, a, -i \cdot y\right), x \cdot \left(y \cdot z - t \cdot a\right) - \left(\sqrt[3]{b \cdot \left(c \cdot z - t \cdot i\right)} \cdot \sqrt[3]{b \cdot \left(c \cdot z - t \cdot i\right)}\right) \cdot \sqrt[3]{\left(b \cdot \left(\sqrt[3]{c \cdot z - t \cdot i} \cdot \sqrt[3]{c \cdot z - t \cdot i}\right)\right) \cdot \sqrt[3]{c \cdot z - t \cdot i}}\right) + \mathsf{fma}\left(-i, y, i \cdot y\right) \cdot j\\ \end{array}\]

Reproduce

herbie shell --seed 2019199 +o rules:numerics
(FPCore (x y z t a b c i j)
  :name "Data.Colour.Matrix:determinant from colour-2.3.3, A"

  :herbie-target
  (if (< x -1.469694296777705e-64) (+ (- (* x (- (* y z) (* t a))) (/ (* b (- (pow (* c z) 2.0) (pow (* t i) 2.0))) (+ (* 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.0) (pow (* t i) 2.0))) (+ (* c z) (* t i)))) (* j (- (* c a) (* y i))))))

  (+ (- (* x (- (* y z) (* t a))) (* b (- (* c z) (* t i)))) (* j (- (* c a) (* y i)))))