Average Error: 7.6 → 4.8
Time: 4.5s
Precision: 64
\[\frac{x \cdot y - z \cdot t}{a}\]
\[\begin{array}{l} \mathbf{if}\;a \le -3.15371004913535115448520191961472535508 \cdot 10^{201} \lor \neg \left(a \le 2.040075352769508416644879369622871361138 \cdot 10^{-47}\right):\\ \;\;\;\;\frac{x}{\frac{a}{y}} - \frac{t}{\sqrt[3]{a} \cdot \sqrt[3]{a}} \cdot \frac{z}{\sqrt[3]{a}}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{a} \cdot \left(x \cdot y - t \cdot z\right)\\ \end{array}\]
\frac{x \cdot y - z \cdot t}{a}
\begin{array}{l}
\mathbf{if}\;a \le -3.15371004913535115448520191961472535508 \cdot 10^{201} \lor \neg \left(a \le 2.040075352769508416644879369622871361138 \cdot 10^{-47}\right):\\
\;\;\;\;\frac{x}{\frac{a}{y}} - \frac{t}{\sqrt[3]{a} \cdot \sqrt[3]{a}} \cdot \frac{z}{\sqrt[3]{a}}\\

\mathbf{else}:\\
\;\;\;\;\frac{1}{a} \cdot \left(x \cdot y - t \cdot z\right)\\

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r760067 = x;
        double r760068 = y;
        double r760069 = r760067 * r760068;
        double r760070 = z;
        double r760071 = t;
        double r760072 = r760070 * r760071;
        double r760073 = r760069 - r760072;
        double r760074 = a;
        double r760075 = r760073 / r760074;
        return r760075;
}

double f(double x, double y, double z, double t, double a) {
        double r760076 = a;
        double r760077 = -3.153710049135351e+201;
        bool r760078 = r760076 <= r760077;
        double r760079 = 2.0400753527695084e-47;
        bool r760080 = r760076 <= r760079;
        double r760081 = !r760080;
        bool r760082 = r760078 || r760081;
        double r760083 = x;
        double r760084 = y;
        double r760085 = r760076 / r760084;
        double r760086 = r760083 / r760085;
        double r760087 = t;
        double r760088 = cbrt(r760076);
        double r760089 = r760088 * r760088;
        double r760090 = r760087 / r760089;
        double r760091 = z;
        double r760092 = r760091 / r760088;
        double r760093 = r760090 * r760092;
        double r760094 = r760086 - r760093;
        double r760095 = 1.0;
        double r760096 = r760095 / r760076;
        double r760097 = r760083 * r760084;
        double r760098 = r760087 * r760091;
        double r760099 = r760097 - r760098;
        double r760100 = r760096 * r760099;
        double r760101 = r760082 ? r760094 : r760100;
        return r760101;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Bits error versus a

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original7.6
Target6.0
Herbie4.8
\[\begin{array}{l} \mathbf{if}\;z \lt -2.468684968699548224247694913169778644284 \cdot 10^{170}:\\ \;\;\;\;\frac{y}{a} \cdot x - \frac{t}{a} \cdot z\\ \mathbf{elif}\;z \lt 6.309831121978371209578784129518242708809 \cdot 10^{-71}:\\ \;\;\;\;\frac{x \cdot y - z \cdot t}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{a} \cdot x - \frac{t}{a} \cdot z\\ \end{array}\]

Derivation

  1. Split input into 2 regimes
  2. if a < -3.153710049135351e+201 or 2.0400753527695084e-47 < a

    1. Initial program 11.3

      \[\frac{x \cdot y - z \cdot t}{a}\]
    2. Using strategy rm
    3. Applied div-sub11.3

      \[\leadsto \color{blue}{\frac{x \cdot y}{a} - \frac{z \cdot t}{a}}\]
    4. Simplified11.3

      \[\leadsto \frac{x \cdot y}{a} - \color{blue}{\frac{t \cdot z}{a}}\]
    5. Using strategy rm
    6. Applied associate-/l*8.9

      \[\leadsto \color{blue}{\frac{x}{\frac{a}{y}}} - \frac{t \cdot z}{a}\]
    7. Using strategy rm
    8. Applied add-cube-cbrt9.3

      \[\leadsto \frac{x}{\frac{a}{y}} - \frac{t \cdot z}{\color{blue}{\left(\sqrt[3]{a} \cdot \sqrt[3]{a}\right) \cdot \sqrt[3]{a}}}\]
    9. Applied times-frac5.4

      \[\leadsto \frac{x}{\frac{a}{y}} - \color{blue}{\frac{t}{\sqrt[3]{a} \cdot \sqrt[3]{a}} \cdot \frac{z}{\sqrt[3]{a}}}\]

    if -3.153710049135351e+201 < a < 2.0400753527695084e-47

    1. Initial program 4.1

      \[\frac{x \cdot y - z \cdot t}{a}\]
    2. Using strategy rm
    3. Applied div-sub4.1

      \[\leadsto \color{blue}{\frac{x \cdot y}{a} - \frac{z \cdot t}{a}}\]
    4. Simplified4.1

      \[\leadsto \frac{x \cdot y}{a} - \color{blue}{\frac{t \cdot z}{a}}\]
    5. Using strategy rm
    6. Applied div-inv4.2

      \[\leadsto \frac{x \cdot y}{a} - \color{blue}{\left(t \cdot z\right) \cdot \frac{1}{a}}\]
    7. Applied div-inv4.2

      \[\leadsto \color{blue}{\left(x \cdot y\right) \cdot \frac{1}{a}} - \left(t \cdot z\right) \cdot \frac{1}{a}\]
    8. Applied distribute-rgt-out--4.2

      \[\leadsto \color{blue}{\frac{1}{a} \cdot \left(x \cdot y - t \cdot z\right)}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification4.8

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \le -3.15371004913535115448520191961472535508 \cdot 10^{201} \lor \neg \left(a \le 2.040075352769508416644879369622871361138 \cdot 10^{-47}\right):\\ \;\;\;\;\frac{x}{\frac{a}{y}} - \frac{t}{\sqrt[3]{a} \cdot \sqrt[3]{a}} \cdot \frac{z}{\sqrt[3]{a}}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{a} \cdot \left(x \cdot y - t \cdot z\right)\\ \end{array}\]

Reproduce

herbie shell --seed 2019322 
(FPCore (x y z t a)
  :name "Data.Colour.Matrix:inverse from colour-2.3.3, B"
  :precision binary64

  :herbie-target
  (if (< z -2.46868496869954822e170) (- (* (/ y a) x) (* (/ t a) z)) (if (< z 6.30983112197837121e-71) (/ (- (* x y) (* z t)) a) (- (* (/ y a) x) (* (/ t a) z))))

  (/ (- (* x y) (* z t)) a))