Average Error: 7.5 → 4.5
Time: 4.0s
Precision: 64
\[\frac{x \cdot y - z \cdot t}{a}\]
\[\begin{array}{l} \mathbf{if}\;x \cdot y \le -9.4533625532482765 \cdot 10^{89}:\\ \;\;\;\;x \cdot \frac{y}{a} - \frac{t}{\frac{a}{z}}\\ \mathbf{elif}\;x \cdot y \le 5.1798943199914996 \cdot 10^{-242}:\\ \;\;\;\;\frac{x \cdot y}{a} - t \cdot \frac{z}{a}\\ \mathbf{elif}\;x \cdot y \le 3.3831985384601801 \cdot 10^{208}:\\ \;\;\;\;\frac{x \cdot y}{a} - \frac{\sqrt[3]{t} \cdot \sqrt[3]{t}}{a} \cdot \left(z \cdot \sqrt[3]{t}\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{y}{a} - \frac{t}{\frac{a}{z}}\\ \end{array}\]
\frac{x \cdot y - z \cdot t}{a}
\begin{array}{l}
\mathbf{if}\;x \cdot y \le -9.4533625532482765 \cdot 10^{89}:\\
\;\;\;\;x \cdot \frac{y}{a} - \frac{t}{\frac{a}{z}}\\

\mathbf{elif}\;x \cdot y \le 5.1798943199914996 \cdot 10^{-242}:\\
\;\;\;\;\frac{x \cdot y}{a} - t \cdot \frac{z}{a}\\

\mathbf{elif}\;x \cdot y \le 3.3831985384601801 \cdot 10^{208}:\\
\;\;\;\;\frac{x \cdot y}{a} - \frac{\sqrt[3]{t} \cdot \sqrt[3]{t}}{a} \cdot \left(z \cdot \sqrt[3]{t}\right)\\

\mathbf{else}:\\
\;\;\;\;x \cdot \frac{y}{a} - \frac{t}{\frac{a}{z}}\\

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r979027 = x;
        double r979028 = y;
        double r979029 = r979027 * r979028;
        double r979030 = z;
        double r979031 = t;
        double r979032 = r979030 * r979031;
        double r979033 = r979029 - r979032;
        double r979034 = a;
        double r979035 = r979033 / r979034;
        return r979035;
}

double f(double x, double y, double z, double t, double a) {
        double r979036 = x;
        double r979037 = y;
        double r979038 = r979036 * r979037;
        double r979039 = -9.453362553248276e+89;
        bool r979040 = r979038 <= r979039;
        double r979041 = a;
        double r979042 = r979037 / r979041;
        double r979043 = r979036 * r979042;
        double r979044 = t;
        double r979045 = z;
        double r979046 = r979041 / r979045;
        double r979047 = r979044 / r979046;
        double r979048 = r979043 - r979047;
        double r979049 = 5.1798943199915e-242;
        bool r979050 = r979038 <= r979049;
        double r979051 = r979038 / r979041;
        double r979052 = r979045 / r979041;
        double r979053 = r979044 * r979052;
        double r979054 = r979051 - r979053;
        double r979055 = 3.38319853846018e+208;
        bool r979056 = r979038 <= r979055;
        double r979057 = cbrt(r979044);
        double r979058 = r979057 * r979057;
        double r979059 = r979058 / r979041;
        double r979060 = r979045 * r979057;
        double r979061 = r979059 * r979060;
        double r979062 = r979051 - r979061;
        double r979063 = r979056 ? r979062 : r979048;
        double r979064 = r979050 ? r979054 : r979063;
        double r979065 = r979040 ? r979048 : r979064;
        return r979065;
}

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.5
Target6.1
Herbie4.5
\[\begin{array}{l} \mathbf{if}\;z \lt -2.46868496869954822 \cdot 10^{170}:\\ \;\;\;\;\frac{y}{a} \cdot x - \frac{t}{a} \cdot z\\ \mathbf{elif}\;z \lt 6.30983112197837121 \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 3 regimes
  2. if (* x y) < -9.453362553248276e+89 or 3.38319853846018e+208 < (* x y)

    1. Initial program 22.6

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

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

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

      \[\leadsto \frac{x \cdot y}{a} - \color{blue}{\frac{t}{\frac{a}{z}}}\]
    7. Using strategy rm
    8. Applied *-un-lft-identity19.9

      \[\leadsto \frac{x \cdot y}{\color{blue}{1 \cdot a}} - \frac{t}{\frac{a}{z}}\]
    9. Applied times-frac3.0

      \[\leadsto \color{blue}{\frac{x}{1} \cdot \frac{y}{a}} - \frac{t}{\frac{a}{z}}\]
    10. Simplified3.0

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

    if -9.453362553248276e+89 < (* x y) < 5.1798943199915e-242

    1. Initial program 3.9

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

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

      \[\leadsto \frac{x \cdot y}{a} - \color{blue}{\frac{t \cdot z}{a}}\]
    5. Using strategy rm
    6. Applied *-un-lft-identity3.9

      \[\leadsto \frac{x \cdot y}{a} - \frac{t \cdot z}{\color{blue}{1 \cdot a}}\]
    7. Applied times-frac5.8

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

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

    if 5.1798943199915e-242 < (* x y) < 3.38319853846018e+208

    1. Initial program 3.7

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

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

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

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

      \[\leadsto \frac{x \cdot y}{a} - \frac{t}{\color{blue}{a \cdot \frac{1}{z}}}\]
    9. Applied add-cube-cbrt4.9

      \[\leadsto \frac{x \cdot y}{a} - \frac{\color{blue}{\left(\sqrt[3]{t} \cdot \sqrt[3]{t}\right) \cdot \sqrt[3]{t}}}{a \cdot \frac{1}{z}}\]
    10. Applied times-frac3.6

      \[\leadsto \frac{x \cdot y}{a} - \color{blue}{\frac{\sqrt[3]{t} \cdot \sqrt[3]{t}}{a} \cdot \frac{\sqrt[3]{t}}{\frac{1}{z}}}\]
    11. Simplified3.5

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y \le -9.4533625532482765 \cdot 10^{89}:\\ \;\;\;\;x \cdot \frac{y}{a} - \frac{t}{\frac{a}{z}}\\ \mathbf{elif}\;x \cdot y \le 5.1798943199914996 \cdot 10^{-242}:\\ \;\;\;\;\frac{x \cdot y}{a} - t \cdot \frac{z}{a}\\ \mathbf{elif}\;x \cdot y \le 3.3831985384601801 \cdot 10^{208}:\\ \;\;\;\;\frac{x \cdot y}{a} - \frac{\sqrt[3]{t} \cdot \sqrt[3]{t}}{a} \cdot \left(z \cdot \sqrt[3]{t}\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{y}{a} - \frac{t}{\frac{a}{z}}\\ \end{array}\]

Reproduce

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

  :herbie-target
  (if (< z -2.468684968699548e+170) (- (* (/ y a) x) (* (/ t a) z)) (if (< z 6.309831121978371e-71) (/ (- (* x y) (* z t)) a) (- (* (/ y a) x) (* (/ t a) z))))

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