Average Error: 12.4 → 12.2
Time: 18.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}\;t \le -8.62546728002503141 \cdot 10^{133}:\\ \;\;\;\;\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(\left(x \cdot \left(\sqrt[3]{\mathsf{fma}\left(y, z, -a \cdot t\right)} \cdot \sqrt[3]{\mathsf{fma}\left(y, z, -a \cdot t\right)}\right)\right) \cdot \sqrt[3]{\mathsf{fma}\left(y, z, -a \cdot t\right)} + x \cdot \mathsf{fma}\left(-a, t, a \cdot t\right)\right) - \left(b \cdot \left(c \cdot z\right) + b \cdot \left(-t \cdot i\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 -8.62546728002503141 \cdot 10^{133}:\\
\;\;\;\;\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(\left(x \cdot \left(\sqrt[3]{\mathsf{fma}\left(y, z, -a \cdot t\right)} \cdot \sqrt[3]{\mathsf{fma}\left(y, z, -a \cdot t\right)}\right)\right) \cdot \sqrt[3]{\mathsf{fma}\left(y, z, -a \cdot t\right)} + x \cdot \mathsf{fma}\left(-a, t, a \cdot t\right)\right) - \left(b \cdot \left(c \cdot z\right) + b \cdot \left(-t \cdot i\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 r1644211 = x;
        double r1644212 = y;
        double r1644213 = z;
        double r1644214 = r1644212 * r1644213;
        double r1644215 = t;
        double r1644216 = a;
        double r1644217 = r1644215 * r1644216;
        double r1644218 = r1644214 - r1644217;
        double r1644219 = r1644211 * r1644218;
        double r1644220 = b;
        double r1644221 = c;
        double r1644222 = r1644221 * r1644213;
        double r1644223 = i;
        double r1644224 = r1644215 * r1644223;
        double r1644225 = r1644222 - r1644224;
        double r1644226 = r1644220 * r1644225;
        double r1644227 = r1644219 - r1644226;
        double r1644228 = j;
        double r1644229 = r1644221 * r1644216;
        double r1644230 = r1644212 * r1644223;
        double r1644231 = r1644229 - r1644230;
        double r1644232 = r1644228 * r1644231;
        double r1644233 = r1644227 + r1644232;
        return r1644233;
}

double f(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
        double r1644234 = t;
        double r1644235 = -8.625467280025031e+133;
        bool r1644236 = r1644234 <= r1644235;
        double r1644237 = i;
        double r1644238 = b;
        double r1644239 = r1644237 * r1644238;
        double r1644240 = z;
        double r1644241 = c;
        double r1644242 = r1644238 * r1644241;
        double r1644243 = x;
        double r1644244 = a;
        double r1644245 = r1644243 * r1644244;
        double r1644246 = r1644234 * r1644245;
        double r1644247 = fma(r1644240, r1644242, r1644246);
        double r1644248 = -r1644247;
        double r1644249 = fma(r1644234, r1644239, r1644248);
        double r1644250 = r1644241 * r1644244;
        double r1644251 = y;
        double r1644252 = r1644251 * r1644237;
        double r1644253 = r1644250 - r1644252;
        double r1644254 = j;
        double r1644255 = r1644244 * r1644234;
        double r1644256 = -r1644255;
        double r1644257 = fma(r1644251, r1644240, r1644256);
        double r1644258 = cbrt(r1644257);
        double r1644259 = r1644258 * r1644258;
        double r1644260 = r1644243 * r1644259;
        double r1644261 = r1644260 * r1644258;
        double r1644262 = -r1644244;
        double r1644263 = fma(r1644262, r1644234, r1644255);
        double r1644264 = r1644243 * r1644263;
        double r1644265 = r1644261 + r1644264;
        double r1644266 = r1644241 * r1644240;
        double r1644267 = r1644238 * r1644266;
        double r1644268 = r1644234 * r1644237;
        double r1644269 = -r1644268;
        double r1644270 = r1644238 * r1644269;
        double r1644271 = r1644267 + r1644270;
        double r1644272 = r1644265 - r1644271;
        double r1644273 = fma(r1644253, r1644254, r1644272);
        double r1644274 = r1644236 ? r1644249 : r1644273;
        return r1644274;
}

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.4
Target20.0
Herbie12.2
\[\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 < -8.625467280025031e+133

    1. Initial program 23.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. Simplified23.1

      \[\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 17.9

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

      \[\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 -8.625467280025031e+133 < t

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

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

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

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

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

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

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

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

Reproduce

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