Average Error: 12.1 → 12.6
Time: 1.0m
Precision: 64
\[\left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - i \cdot a\right)\right) + j \cdot \left(c \cdot t - i \cdot y\right)\]
\[\begin{array}{l} \mathbf{if}\;x \le -2.946192327766243075167726822032469815816 \cdot 10^{-118}:\\ \;\;\;\;\mathsf{fma}\left(c \cdot t - i \cdot y, j, \mathsf{fma}\left(i \cdot a - z \cdot c, b, \left(y \cdot z - t \cdot a\right) \cdot x\right)\right)\\ \mathbf{elif}\;x \le 1.141247624710465205318881101525926390653 \cdot 10^{-147}:\\ \;\;\;\;\mathsf{fma}\left(c \cdot t - i \cdot y, j, \mathsf{fma}\left(i \cdot a - z \cdot c, b, 0\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(c \cdot t - i \cdot y, j, \mathsf{fma}\left(i \cdot a - z \cdot c, b, \left(y \cdot z - t \cdot a\right) \cdot x\right)\right)\\ \end{array}\]
\left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - i \cdot a\right)\right) + j \cdot \left(c \cdot t - i \cdot y\right)
\begin{array}{l}
\mathbf{if}\;x \le -2.946192327766243075167726822032469815816 \cdot 10^{-118}:\\
\;\;\;\;\mathsf{fma}\left(c \cdot t - i \cdot y, j, \mathsf{fma}\left(i \cdot a - z \cdot c, b, \left(y \cdot z - t \cdot a\right) \cdot x\right)\right)\\

\mathbf{elif}\;x \le 1.141247624710465205318881101525926390653 \cdot 10^{-147}:\\
\;\;\;\;\mathsf{fma}\left(c \cdot t - i \cdot y, j, \mathsf{fma}\left(i \cdot a - z \cdot c, b, 0\right)\right)\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(c \cdot t - i \cdot y, j, \mathsf{fma}\left(i \cdot a - z \cdot c, b, \left(y \cdot z - t \cdot a\right) \cdot x\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 r4344988 = x;
        double r4344989 = y;
        double r4344990 = z;
        double r4344991 = r4344989 * r4344990;
        double r4344992 = t;
        double r4344993 = a;
        double r4344994 = r4344992 * r4344993;
        double r4344995 = r4344991 - r4344994;
        double r4344996 = r4344988 * r4344995;
        double r4344997 = b;
        double r4344998 = c;
        double r4344999 = r4344998 * r4344990;
        double r4345000 = i;
        double r4345001 = r4345000 * r4344993;
        double r4345002 = r4344999 - r4345001;
        double r4345003 = r4344997 * r4345002;
        double r4345004 = r4344996 - r4345003;
        double r4345005 = j;
        double r4345006 = r4344998 * r4344992;
        double r4345007 = r4345000 * r4344989;
        double r4345008 = r4345006 - r4345007;
        double r4345009 = r4345005 * r4345008;
        double r4345010 = r4345004 + r4345009;
        return r4345010;
}

double f(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
        double r4345011 = x;
        double r4345012 = -2.946192327766243e-118;
        bool r4345013 = r4345011 <= r4345012;
        double r4345014 = c;
        double r4345015 = t;
        double r4345016 = r4345014 * r4345015;
        double r4345017 = i;
        double r4345018 = y;
        double r4345019 = r4345017 * r4345018;
        double r4345020 = r4345016 - r4345019;
        double r4345021 = j;
        double r4345022 = a;
        double r4345023 = r4345017 * r4345022;
        double r4345024 = z;
        double r4345025 = r4345024 * r4345014;
        double r4345026 = r4345023 - r4345025;
        double r4345027 = b;
        double r4345028 = r4345018 * r4345024;
        double r4345029 = r4345015 * r4345022;
        double r4345030 = r4345028 - r4345029;
        double r4345031 = r4345030 * r4345011;
        double r4345032 = fma(r4345026, r4345027, r4345031);
        double r4345033 = fma(r4345020, r4345021, r4345032);
        double r4345034 = 1.1412476247104652e-147;
        bool r4345035 = r4345011 <= r4345034;
        double r4345036 = 0.0;
        double r4345037 = fma(r4345026, r4345027, r4345036);
        double r4345038 = fma(r4345020, r4345021, r4345037);
        double r4345039 = r4345035 ? r4345038 : r4345033;
        double r4345040 = r4345013 ? r4345033 : r4345039;
        return r4345040;
}

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

Derivation

  1. Split input into 2 regimes
  2. if x < -2.946192327766243e-118 or 1.1412476247104652e-147 < x

    1. Initial program 9.0

      \[\left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - i \cdot a\right)\right) + j \cdot \left(c \cdot t - i \cdot y\right)\]
    2. Simplified9.0

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

    if -2.946192327766243e-118 < x < 1.1412476247104652e-147

    1. Initial program 17.6

      \[\left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - i \cdot a\right)\right) + j \cdot \left(c \cdot t - i \cdot y\right)\]
    2. Simplified17.6

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -2.946192327766243075167726822032469815816 \cdot 10^{-118}:\\ \;\;\;\;\mathsf{fma}\left(c \cdot t - i \cdot y, j, \mathsf{fma}\left(i \cdot a - z \cdot c, b, \left(y \cdot z - t \cdot a\right) \cdot x\right)\right)\\ \mathbf{elif}\;x \le 1.141247624710465205318881101525926390653 \cdot 10^{-147}:\\ \;\;\;\;\mathsf{fma}\left(c \cdot t - i \cdot y, j, \mathsf{fma}\left(i \cdot a - z \cdot c, b, 0\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(c \cdot t - i \cdot y, j, \mathsf{fma}\left(i \cdot a - z \cdot c, b, \left(y \cdot z - t \cdot a\right) \cdot x\right)\right)\\ \end{array}\]

Reproduce

herbie shell --seed 2019200 +o rules:numerics
(FPCore (x y z t a b c i j)
  :name "Linear.Matrix:det33 from linear-1.19.1.3"
  (+ (- (* x (- (* y z) (* t a))) (* b (- (* c z) (* i a)))) (* j (- (* c t) (* i y)))))