Average Error: 7.2 → 0.8
Time: 3.0s
Precision: 64
\[\frac{x \cdot y - z \cdot t}{a}\]
\[\begin{array}{l} \mathbf{if}\;x \cdot y - z \cdot t = -\infty \lor \neg \left(x \cdot y - z \cdot t \le 1.289984888446294143698575098275272478903 \cdot 10^{281}\right):\\ \;\;\;\;x \cdot \frac{y}{a} - \left(\sqrt[3]{t \cdot \frac{z}{a}} \cdot \sqrt[3]{t \cdot \frac{z}{a}}\right) \cdot \sqrt[3]{t \cdot \frac{z}{a}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot y}{a} - \left(t \cdot z\right) \cdot \frac{1}{a}\\ \end{array}\]
\frac{x \cdot y - z \cdot t}{a}
\begin{array}{l}
\mathbf{if}\;x \cdot y - z \cdot t = -\infty \lor \neg \left(x \cdot y - z \cdot t \le 1.289984888446294143698575098275272478903 \cdot 10^{281}\right):\\
\;\;\;\;x \cdot \frac{y}{a} - \left(\sqrt[3]{t \cdot \frac{z}{a}} \cdot \sqrt[3]{t \cdot \frac{z}{a}}\right) \cdot \sqrt[3]{t \cdot \frac{z}{a}}\\

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r878923 = x;
        double r878924 = y;
        double r878925 = r878923 * r878924;
        double r878926 = z;
        double r878927 = t;
        double r878928 = r878926 * r878927;
        double r878929 = r878925 - r878928;
        double r878930 = a;
        double r878931 = r878929 / r878930;
        return r878931;
}

double f(double x, double y, double z, double t, double a) {
        double r878932 = x;
        double r878933 = y;
        double r878934 = r878932 * r878933;
        double r878935 = z;
        double r878936 = t;
        double r878937 = r878935 * r878936;
        double r878938 = r878934 - r878937;
        double r878939 = -inf.0;
        bool r878940 = r878938 <= r878939;
        double r878941 = 1.2899848884462941e+281;
        bool r878942 = r878938 <= r878941;
        double r878943 = !r878942;
        bool r878944 = r878940 || r878943;
        double r878945 = a;
        double r878946 = r878933 / r878945;
        double r878947 = r878932 * r878946;
        double r878948 = r878935 / r878945;
        double r878949 = r878936 * r878948;
        double r878950 = cbrt(r878949);
        double r878951 = r878950 * r878950;
        double r878952 = r878951 * r878950;
        double r878953 = r878947 - r878952;
        double r878954 = r878934 / r878945;
        double r878955 = r878936 * r878935;
        double r878956 = 1.0;
        double r878957 = r878956 / r878945;
        double r878958 = r878955 * r878957;
        double r878959 = r878954 - r878958;
        double r878960 = r878944 ? r878953 : r878959;
        return r878960;
}

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.2
Target5.7
Herbie0.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 (- (* x y) (* z t)) < -inf.0 or 1.2899848884462941e+281 < (- (* x y) (* z t))

    1. Initial program 55.6

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

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

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

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

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

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

      \[\leadsto \frac{x \cdot y}{\color{blue}{1 \cdot a}} - t \cdot \frac{z}{a}\]
    11. Applied times-frac0.3

      \[\leadsto \color{blue}{\frac{x}{1} \cdot \frac{y}{a}} - t \cdot \frac{z}{a}\]
    12. Simplified0.3

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

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

    if -inf.0 < (- (* x y) (* z t)) < 1.2899848884462941e+281

    1. Initial program 0.7

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

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

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

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

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

      \[\leadsto \frac{x \cdot y}{a} - \color{blue}{t} \cdot \frac{z}{a}\]
    9. Using strategy rm
    10. Applied div-inv5.5

      \[\leadsto \frac{x \cdot y}{a} - t \cdot \color{blue}{\left(z \cdot \frac{1}{a}\right)}\]
    11. Applied associate-*r*0.8

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

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

Reproduce

herbie shell --seed 2019354 
(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))