Average Error: 7.5 → 0.9
Time: 15.5s
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 9.781846460984151296893166805851316141382 \cdot 10^{239}\right):\\ \;\;\;\;\frac{x}{\sqrt[3]{a} \cdot \sqrt[3]{a}} \cdot \frac{y}{\sqrt[3]{a}} - t \cdot \frac{z}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{a} \cdot \left(x \cdot y - t \cdot z\right)\\ \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 9.781846460984151296893166805851316141382 \cdot 10^{239}\right):\\
\;\;\;\;\frac{x}{\sqrt[3]{a} \cdot \sqrt[3]{a}} \cdot \frac{y}{\sqrt[3]{a}} - t \cdot \frac{z}{a}\\

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r580595 = x;
        double r580596 = y;
        double r580597 = r580595 * r580596;
        double r580598 = z;
        double r580599 = t;
        double r580600 = r580598 * r580599;
        double r580601 = r580597 - r580600;
        double r580602 = a;
        double r580603 = r580601 / r580602;
        return r580603;
}

double f(double x, double y, double z, double t, double a) {
        double r580604 = x;
        double r580605 = y;
        double r580606 = r580604 * r580605;
        double r580607 = z;
        double r580608 = t;
        double r580609 = r580607 * r580608;
        double r580610 = r580606 - r580609;
        double r580611 = -inf.0;
        bool r580612 = r580610 <= r580611;
        double r580613 = 9.781846460984151e+239;
        bool r580614 = r580610 <= r580613;
        double r580615 = !r580614;
        bool r580616 = r580612 || r580615;
        double r580617 = a;
        double r580618 = cbrt(r580617);
        double r580619 = r580618 * r580618;
        double r580620 = r580604 / r580619;
        double r580621 = r580605 / r580618;
        double r580622 = r580620 * r580621;
        double r580623 = r580607 / r580617;
        double r580624 = r580608 * r580623;
        double r580625 = r580622 - r580624;
        double r580626 = 1.0;
        double r580627 = r580626 / r580617;
        double r580628 = r580608 * r580607;
        double r580629 = r580606 - r580628;
        double r580630 = r580627 * r580629;
        double r580631 = r580616 ? r580625 : r580630;
        return r580631;
}

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
Herbie0.9
\[\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 9.781846460984151e+239 < (- (* x y) (* z t))

    1. Initial program 45.8

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

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

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

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

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

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

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

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

    if -inf.0 < (- (* x y) (* z t)) < 9.781846460984151e+239

    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 div-inv0.8

      \[\leadsto \frac{x \cdot y}{a} - \color{blue}{\left(t \cdot z\right) \cdot \frac{1}{a}}\]
    7. Applied div-inv0.8

      \[\leadsto \color{blue}{\left(x \cdot y\right) \cdot \frac{1}{a}} - \left(t \cdot z\right) \cdot \frac{1}{a}\]
    8. Applied distribute-rgt-out--0.8

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

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

Reproduce

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

  :herbie-target
  (if (< z -2.46868496869954822e170) (- (* (/ y a) x) (* (/ t a) z)) (if (< z 6.30983112197837121e-71) (/ (- (* x y) (* z t)) a) (- (* (/ y a) x) (* (/ t a) z))))

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