Average Error: 7.8 → 5.0
Time: 3.4s
Precision: 64
\[\frac{x \cdot y - z \cdot t}{a}\]
\[\begin{array}{l} \mathbf{if}\;x \cdot y \le -1.84154847940333438 \cdot 10^{268}:\\ \;\;\;\;x \cdot \frac{y}{a} - \frac{t \cdot z}{a}\\ \mathbf{elif}\;x \cdot y \le 5.0132949514285239 \cdot 10^{-62}:\\ \;\;\;\;\frac{1}{\frac{a}{x \cdot y - z \cdot t}}\\ \mathbf{elif}\;x \cdot y \le 2.10280870876133442 \cdot 10^{131}:\\ \;\;\;\;\frac{x \cdot y}{a} - \frac{t}{\sqrt[3]{a} \cdot \sqrt[3]{a}} \cdot \frac{z}{\sqrt[3]{a}}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{y}{a} - \frac{t \cdot z}{a}\\ \end{array}\]
\frac{x \cdot y - z \cdot t}{a}
\begin{array}{l}
\mathbf{if}\;x \cdot y \le -1.84154847940333438 \cdot 10^{268}:\\
\;\;\;\;x \cdot \frac{y}{a} - \frac{t \cdot z}{a}\\

\mathbf{elif}\;x \cdot y \le 5.0132949514285239 \cdot 10^{-62}:\\
\;\;\;\;\frac{1}{\frac{a}{x \cdot y - z \cdot t}}\\

\mathbf{elif}\;x \cdot y \le 2.10280870876133442 \cdot 10^{131}:\\
\;\;\;\;\frac{x \cdot y}{a} - \frac{t}{\sqrt[3]{a} \cdot \sqrt[3]{a}} \cdot \frac{z}{\sqrt[3]{a}}\\

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r1081880 = x;
        double r1081881 = y;
        double r1081882 = r1081880 * r1081881;
        double r1081883 = z;
        double r1081884 = t;
        double r1081885 = r1081883 * r1081884;
        double r1081886 = r1081882 - r1081885;
        double r1081887 = a;
        double r1081888 = r1081886 / r1081887;
        return r1081888;
}

double f(double x, double y, double z, double t, double a) {
        double r1081889 = x;
        double r1081890 = y;
        double r1081891 = r1081889 * r1081890;
        double r1081892 = -1.8415484794033344e+268;
        bool r1081893 = r1081891 <= r1081892;
        double r1081894 = a;
        double r1081895 = r1081890 / r1081894;
        double r1081896 = r1081889 * r1081895;
        double r1081897 = t;
        double r1081898 = z;
        double r1081899 = r1081897 * r1081898;
        double r1081900 = r1081899 / r1081894;
        double r1081901 = r1081896 - r1081900;
        double r1081902 = 5.013294951428524e-62;
        bool r1081903 = r1081891 <= r1081902;
        double r1081904 = 1.0;
        double r1081905 = r1081898 * r1081897;
        double r1081906 = r1081891 - r1081905;
        double r1081907 = r1081894 / r1081906;
        double r1081908 = r1081904 / r1081907;
        double r1081909 = 2.1028087087613344e+131;
        bool r1081910 = r1081891 <= r1081909;
        double r1081911 = r1081891 / r1081894;
        double r1081912 = cbrt(r1081894);
        double r1081913 = r1081912 * r1081912;
        double r1081914 = r1081897 / r1081913;
        double r1081915 = r1081898 / r1081912;
        double r1081916 = r1081914 * r1081915;
        double r1081917 = r1081911 - r1081916;
        double r1081918 = r1081910 ? r1081917 : r1081901;
        double r1081919 = r1081903 ? r1081908 : r1081918;
        double r1081920 = r1081893 ? r1081901 : r1081919;
        return r1081920;
}

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.8
Target6.3
Herbie5.0
\[\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) < -1.8415484794033344e+268 or 2.1028087087613344e+131 < (* x y)

    1. Initial program 28.0

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

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

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

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

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

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

    if -1.8415484794033344e+268 < (* x y) < 5.013294951428524e-62

    1. Initial program 4.6

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

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

    if 5.013294951428524e-62 < (* x y) < 2.1028087087613344e+131

    1. Initial program 3.1

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

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

      \[\leadsto \frac{x \cdot y}{a} - \color{blue}{\frac{t \cdot z}{a}}\]
    5. Using strategy rm
    6. Applied add-cube-cbrt3.4

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

      \[\leadsto \frac{x \cdot y}{a} - \color{blue}{\frac{t}{\sqrt[3]{a} \cdot \sqrt[3]{a}} \cdot \frac{z}{\sqrt[3]{a}}}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification5.0

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y \le -1.84154847940333438 \cdot 10^{268}:\\ \;\;\;\;x \cdot \frac{y}{a} - \frac{t \cdot z}{a}\\ \mathbf{elif}\;x \cdot y \le 5.0132949514285239 \cdot 10^{-62}:\\ \;\;\;\;\frac{1}{\frac{a}{x \cdot y - z \cdot t}}\\ \mathbf{elif}\;x \cdot y \le 2.10280870876133442 \cdot 10^{131}:\\ \;\;\;\;\frac{x \cdot y}{a} - \frac{t}{\sqrt[3]{a} \cdot \sqrt[3]{a}} \cdot \frac{z}{\sqrt[3]{a}}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{y}{a} - \frac{t \cdot z}{a}\\ \end{array}\]

Reproduce

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