Average Error: 7.9 → 0.9
Time: 4.2s
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} \lor \neg \left(\frac{x \cdot y - z \cdot t}{a} \le 1.74421414347862621 \cdot 10^{294}\right)\right)\right):\\ \;\;\;\;x \cdot \frac{y}{a} - \frac{t}{\sqrt[3]{a} \cdot \left(\sqrt[3]{\sqrt[3]{a} \cdot \sqrt[3]{a}} \cdot \sqrt[3]{\sqrt[3]{a}}\right)} \cdot \frac{z}{\sqrt[3]{a}}\\ \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} \lor \neg \left(\frac{x \cdot y - z \cdot t}{a} \le 1.74421414347862621 \cdot 10^{294}\right)\right)\right):\\
\;\;\;\;x \cdot \frac{y}{a} - \frac{t}{\sqrt[3]{a} \cdot \left(\sqrt[3]{\sqrt[3]{a} \cdot \sqrt[3]{a}} \cdot \sqrt[3]{\sqrt[3]{a}}\right)} \cdot \frac{z}{\sqrt[3]{a}}\\

\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 r929387 = x;
        double r929388 = y;
        double r929389 = r929387 * r929388;
        double r929390 = z;
        double r929391 = t;
        double r929392 = r929390 * r929391;
        double r929393 = r929389 - r929392;
        double r929394 = a;
        double r929395 = r929393 / r929394;
        return r929395;
}

double f(double x, double y, double z, double t, double a) {
        double r929396 = x;
        double r929397 = y;
        double r929398 = r929396 * r929397;
        double r929399 = z;
        double r929400 = t;
        double r929401 = r929399 * r929400;
        double r929402 = r929398 - r929401;
        double r929403 = a;
        double r929404 = r929402 / r929403;
        double r929405 = -2.0589338067901153e+303;
        bool r929406 = r929404 <= r929405;
        double r929407 = -2.249949624916008e-304;
        bool r929408 = r929404 <= r929407;
        double r929409 = 2.9643938750475e-323;
        bool r929410 = r929404 <= r929409;
        double r929411 = 1.7442141434786262e+294;
        bool r929412 = r929404 <= r929411;
        double r929413 = !r929412;
        bool r929414 = r929410 || r929413;
        double r929415 = !r929414;
        bool r929416 = r929408 || r929415;
        double r929417 = !r929416;
        bool r929418 = r929406 || r929417;
        double r929419 = r929397 / r929403;
        double r929420 = r929396 * r929419;
        double r929421 = cbrt(r929403);
        double r929422 = r929421 * r929421;
        double r929423 = cbrt(r929422);
        double r929424 = cbrt(r929421);
        double r929425 = r929423 * r929424;
        double r929426 = r929421 * r929425;
        double r929427 = r929400 / r929426;
        double r929428 = r929399 / r929421;
        double r929429 = r929427 * r929428;
        double r929430 = r929420 - r929429;
        double r929431 = 1.0;
        double r929432 = r929403 / r929402;
        double r929433 = r929431 / r929432;
        double r929434 = r929418 ? r929430 : r929433;
        return r929434;
}

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 add-cube-cbrt2.5

      \[\leadsto x \cdot \frac{y}{a} - \frac{t}{\sqrt[3]{a} \cdot \sqrt[3]{\color{blue}{\left(\sqrt[3]{a} \cdot \sqrt[3]{a}\right) \cdot \sqrt[3]{a}}}} \cdot \frac{z}{\sqrt[3]{a}}\]
    14. Applied cbrt-prod2.5

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

    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} \lor \neg \left(\frac{x \cdot y - z \cdot t}{a} \le 1.74421414347862621 \cdot 10^{294}\right)\right)\right):\\ \;\;\;\;x \cdot \frac{y}{a} - \frac{t}{\sqrt[3]{a} \cdot \left(\sqrt[3]{\sqrt[3]{a} \cdot \sqrt[3]{a}} \cdot \sqrt[3]{\sqrt[3]{a}}\right)} \cdot \frac{z}{\sqrt[3]{a}}\\ \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))