Average Error: 12.1 → 9.8
Time: 18.0s
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}\;j \le -8.513159297671363159858416809829746638287 \cdot 10^{76} \lor \neg \left(j \le 5.870049940284521979052685109618079827487 \cdot 10^{61}\right):\\ \;\;\;\;\mathsf{fma}\left(c \cdot t - i \cdot y, j, x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - i \cdot a\right)\right) + \mathsf{fma}\left(-y, i, y \cdot i\right) \cdot j\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(c, t \cdot j, \left(\left(y \cdot z\right) \cdot x + \left(-a \cdot \left(x \cdot t\right)\right)\right) - b \cdot \left(c \cdot z - i \cdot a\right)\right) + \left(-j \cdot i\right) \cdot y\\ \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}\;j \le -8.513159297671363159858416809829746638287 \cdot 10^{76} \lor \neg \left(j \le 5.870049940284521979052685109618079827487 \cdot 10^{61}\right):\\
\;\;\;\;\mathsf{fma}\left(c \cdot t - i \cdot y, j, x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - i \cdot a\right)\right) + \mathsf{fma}\left(-y, i, y \cdot i\right) \cdot j\\

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

\end{array}
double f(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
        double r437770 = x;
        double r437771 = y;
        double r437772 = z;
        double r437773 = r437771 * r437772;
        double r437774 = t;
        double r437775 = a;
        double r437776 = r437774 * r437775;
        double r437777 = r437773 - r437776;
        double r437778 = r437770 * r437777;
        double r437779 = b;
        double r437780 = c;
        double r437781 = r437780 * r437772;
        double r437782 = i;
        double r437783 = r437782 * r437775;
        double r437784 = r437781 - r437783;
        double r437785 = r437779 * r437784;
        double r437786 = r437778 - r437785;
        double r437787 = j;
        double r437788 = r437780 * r437774;
        double r437789 = r437782 * r437771;
        double r437790 = r437788 - r437789;
        double r437791 = r437787 * r437790;
        double r437792 = r437786 + r437791;
        return r437792;
}

double f(double x, double y, double z, double t, double a, double b, double c, double i, double j) {
        double r437793 = j;
        double r437794 = -8.513159297671363e+76;
        bool r437795 = r437793 <= r437794;
        double r437796 = 5.870049940284522e+61;
        bool r437797 = r437793 <= r437796;
        double r437798 = !r437797;
        bool r437799 = r437795 || r437798;
        double r437800 = c;
        double r437801 = t;
        double r437802 = r437800 * r437801;
        double r437803 = i;
        double r437804 = y;
        double r437805 = r437803 * r437804;
        double r437806 = r437802 - r437805;
        double r437807 = x;
        double r437808 = z;
        double r437809 = r437804 * r437808;
        double r437810 = a;
        double r437811 = r437801 * r437810;
        double r437812 = r437809 - r437811;
        double r437813 = r437807 * r437812;
        double r437814 = b;
        double r437815 = r437800 * r437808;
        double r437816 = r437803 * r437810;
        double r437817 = r437815 - r437816;
        double r437818 = r437814 * r437817;
        double r437819 = r437813 - r437818;
        double r437820 = fma(r437806, r437793, r437819);
        double r437821 = -r437804;
        double r437822 = r437804 * r437803;
        double r437823 = fma(r437821, r437803, r437822);
        double r437824 = r437823 * r437793;
        double r437825 = r437820 + r437824;
        double r437826 = r437801 * r437793;
        double r437827 = r437809 * r437807;
        double r437828 = r437807 * r437801;
        double r437829 = r437810 * r437828;
        double r437830 = -r437829;
        double r437831 = r437827 + r437830;
        double r437832 = r437831 - r437818;
        double r437833 = fma(r437800, r437826, r437832);
        double r437834 = r437793 * r437803;
        double r437835 = -r437834;
        double r437836 = r437835 * r437804;
        double r437837 = r437833 + r437836;
        double r437838 = r437799 ? r437825 : r437837;
        return r437838;
}

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
Target15.8
Herbie9.8
\[\begin{array}{l} \mathbf{if}\;t \lt -8.12097891919591218149793027759825150959 \cdot 10^{-33}:\\ \;\;\;\;x \cdot \left(z \cdot y - a \cdot t\right) - \left(b \cdot \left(z \cdot c - a \cdot i\right) - \left(c \cdot t - y \cdot i\right) \cdot j\right)\\ \mathbf{elif}\;t \lt -4.712553818218485141757938537793350881052 \cdot 10^{-169}:\\ \;\;\;\;\left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - i \cdot a\right)\right) + \frac{j \cdot \left({\left(c \cdot t\right)}^{2} - {\left(i \cdot y\right)}^{2}\right)}{c \cdot t + i \cdot y}\\ \mathbf{elif}\;t \lt -7.633533346031583686060259351057142920433 \cdot 10^{-308}:\\ \;\;\;\;x \cdot \left(z \cdot y - a \cdot t\right) - \left(b \cdot \left(z \cdot c - a \cdot i\right) - \left(c \cdot t - y \cdot i\right) \cdot j\right)\\ \mathbf{elif}\;t \lt 1.053588855745548710002760210539645467715 \cdot 10^{-139}:\\ \;\;\;\;\left(x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - i \cdot a\right)\right) + \frac{j \cdot \left({\left(c \cdot t\right)}^{2} - {\left(i \cdot y\right)}^{2}\right)}{c \cdot t + i \cdot y}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \left(z \cdot y - a \cdot t\right) - \left(b \cdot \left(z \cdot c - a \cdot i\right) - \left(c \cdot t - y \cdot i\right) \cdot j\right)\\ \end{array}\]

Derivation

  1. Split input into 2 regimes
  2. if j < -8.513159297671363e+76 or 5.870049940284522e+61 < j

    1. Initial program 8.1

      \[\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. Using strategy rm
    3. Applied prod-diff8.1

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

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

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

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

    if -8.513159297671363e+76 < j < 5.870049940284522e+61

    1. Initial program 13.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. Using strategy rm
    3. Applied sub-neg13.6

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

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

      \[\leadsto \color{blue}{\left(\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\right)\right) + j \cdot \left(-i \cdot y\right)}\]
    6. Simplified11.9

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

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

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

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

      \[\leadsto \mathsf{fma}\left(c, t \cdot j, \left(\left(y \cdot z\right) \cdot x + \color{blue}{\left(-a \cdot \left(x \cdot t\right)\right)}\right) - b \cdot \left(c \cdot z - i \cdot a\right)\right) + j \cdot \left(-i \cdot y\right)\]
    12. Using strategy rm
    13. Applied distribute-lft-neg-in12.4

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;j \le -8.513159297671363159858416809829746638287 \cdot 10^{76} \lor \neg \left(j \le 5.870049940284521979052685109618079827487 \cdot 10^{61}\right):\\ \;\;\;\;\mathsf{fma}\left(c \cdot t - i \cdot y, j, x \cdot \left(y \cdot z - t \cdot a\right) - b \cdot \left(c \cdot z - i \cdot a\right)\right) + \mathsf{fma}\left(-y, i, y \cdot i\right) \cdot j\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(c, t \cdot j, \left(\left(y \cdot z\right) \cdot x + \left(-a \cdot \left(x \cdot t\right)\right)\right) - b \cdot \left(c \cdot z - i \cdot a\right)\right) + \left(-j \cdot i\right) \cdot y\\ \end{array}\]

Reproduce

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

  :herbie-target
  (if (< t -8.120978919195912e-33) (- (* x (- (* z y) (* a t))) (- (* b (- (* z c) (* a i))) (* (- (* c t) (* y i)) j))) (if (< t -4.712553818218485e-169) (+ (- (* x (- (* y z) (* t a))) (* b (- (* c z) (* i a)))) (/ (* j (- (pow (* c t) 2) (pow (* i y) 2))) (+ (* c t) (* i y)))) (if (< t -7.633533346031584e-308) (- (* x (- (* z y) (* a t))) (- (* b (- (* z c) (* a i))) (* (- (* c t) (* y i)) j))) (if (< t 1.0535888557455487e-139) (+ (- (* x (- (* y z) (* t a))) (* b (- (* c z) (* i a)))) (/ (* j (- (pow (* c t) 2) (pow (* i y) 2))) (+ (* c t) (* i y)))) (- (* x (- (* z y) (* a t))) (- (* b (- (* z c) (* a i))) (* (- (* c t) (* y i)) j)))))))

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