Average Error: 7.9 → 0.9
Time: 6.9s
Precision: 64
\[\frac{x \cdot y - z \cdot t}{a}\]
\[\begin{array}{l} \mathbf{if}\;\frac{x \cdot y - z \cdot t}{a} \le -2.05893380679011527 \cdot 10^{303} \lor \neg \left(\frac{x \cdot y - z \cdot t}{a} \le -2.2499496249160079 \cdot 10^{-304} \lor \neg \left(\frac{x \cdot y - z \cdot t}{a} \le 2.96439 \cdot 10^{-323}\right) \land \frac{x \cdot y - z \cdot t}{a} \le 1.74421414347862621 \cdot 10^{294}\right):\\ \;\;\;\;x \cdot \frac{y}{a} - t \cdot \frac{z}{{\left(\sqrt[3]{a}\right)}^{3}}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\frac{a}{x \cdot y - z \cdot t}}\\ \end{array}\]
\frac{x \cdot y - z \cdot t}{a}
\begin{array}{l}
\mathbf{if}\;\frac{x \cdot y - z \cdot t}{a} \le -2.05893380679011527 \cdot 10^{303} \lor \neg \left(\frac{x \cdot y - z \cdot t}{a} \le -2.2499496249160079 \cdot 10^{-304} \lor \neg \left(\frac{x \cdot y - z \cdot t}{a} \le 2.96439 \cdot 10^{-323}\right) \land \frac{x \cdot y - z \cdot t}{a} \le 1.74421414347862621 \cdot 10^{294}\right):\\
\;\;\;\;x \cdot \frac{y}{a} - t \cdot \frac{z}{{\left(\sqrt[3]{a}\right)}^{3}}\\

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r1111221 = x;
        double r1111222 = y;
        double r1111223 = r1111221 * r1111222;
        double r1111224 = z;
        double r1111225 = t;
        double r1111226 = r1111224 * r1111225;
        double r1111227 = r1111223 - r1111226;
        double r1111228 = a;
        double r1111229 = r1111227 / r1111228;
        return r1111229;
}

double f(double x, double y, double z, double t, double a) {
        double r1111230 = x;
        double r1111231 = y;
        double r1111232 = r1111230 * r1111231;
        double r1111233 = z;
        double r1111234 = t;
        double r1111235 = r1111233 * r1111234;
        double r1111236 = r1111232 - r1111235;
        double r1111237 = a;
        double r1111238 = r1111236 / r1111237;
        double r1111239 = -2.0589338067901153e+303;
        bool r1111240 = r1111238 <= r1111239;
        double r1111241 = -2.249949624916008e-304;
        bool r1111242 = r1111238 <= r1111241;
        double r1111243 = 2.9643938750475e-323;
        bool r1111244 = r1111238 <= r1111243;
        double r1111245 = !r1111244;
        double r1111246 = 1.7442141434786262e+294;
        bool r1111247 = r1111238 <= r1111246;
        bool r1111248 = r1111245 && r1111247;
        bool r1111249 = r1111242 || r1111248;
        double r1111250 = !r1111249;
        bool r1111251 = r1111240 || r1111250;
        double r1111252 = r1111231 / r1111237;
        double r1111253 = r1111230 * r1111252;
        double r1111254 = cbrt(r1111237);
        double r1111255 = 3.0;
        double r1111256 = pow(r1111254, r1111255);
        double r1111257 = r1111233 / r1111256;
        double r1111258 = r1111234 * r1111257;
        double r1111259 = r1111253 - r1111258;
        double r1111260 = 1.0;
        double r1111261 = r1111237 / r1111236;
        double r1111262 = r1111260 / r1111261;
        double r1111263 = r1111251 ? r1111259 : r1111262;
        return r1111263;
}

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.9
Target6.0
Herbie0.9
\[\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 2 regimes
  2. if (/ (- (* x y) (* z t)) a) < -2.0589338067901153e+303 or -2.249949624916008e-304 < (/ (- (* x y) (* z t)) a) < 2.9643938750475e-323 or 1.7442141434786262e+294 < (/ (- (* x y) (* z t)) a)

    1. Initial program 37.8

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

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

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

      \[\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-frac20.5

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

      \[\leadsto \frac{x \cdot y}{\color{blue}{1 \cdot a}} - \frac{t}{\sqrt[3]{a} \cdot \sqrt[3]{a}} \cdot \frac{z}{\sqrt[3]{a}}\]
    10. Applied times-frac2.4

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

      \[\leadsto \color{blue}{x} \cdot \frac{y}{a} - \frac{t}{\sqrt[3]{a} \cdot \sqrt[3]{a}} \cdot \frac{z}{\sqrt[3]{a}}\]
    12. Using strategy rm
    13. Applied div-inv2.4

      \[\leadsto x \cdot \frac{y}{a} - \color{blue}{\left(t \cdot \frac{1}{\sqrt[3]{a} \cdot \sqrt[3]{a}}\right)} \cdot \frac{z}{\sqrt[3]{a}}\]
    14. Applied associate-*l*2.5

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

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

    if -2.0589338067901153e+303 < (/ (- (* x y) (* z t)) a) < -2.249949624916008e-304 or 2.9643938750475e-323 < (/ (- (* x y) (* z t)) a) < 1.7442141434786262e+294

    1. Initial program 0.3

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x \cdot y - z \cdot t}{a} \le -2.05893380679011527 \cdot 10^{303} \lor \neg \left(\frac{x \cdot y - z \cdot t}{a} \le -2.2499496249160079 \cdot 10^{-304} \lor \neg \left(\frac{x \cdot y - z \cdot t}{a} \le 2.96439 \cdot 10^{-323}\right) \land \frac{x \cdot y - z \cdot t}{a} \le 1.74421414347862621 \cdot 10^{294}\right):\\ \;\;\;\;x \cdot \frac{y}{a} - t \cdot \frac{z}{{\left(\sqrt[3]{a}\right)}^{3}}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\frac{a}{x \cdot y - z \cdot t}}\\ \end{array}\]

Reproduce

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