Average Error: 7.6 → 1.3
Time: 9.9s
Precision: 64
\[\frac{x \cdot y - z \cdot t}{a}\]
\[\begin{array}{l} \mathbf{if}\;x \cdot y - z \cdot t \le -1.703235287902862224100755201234564323846 \cdot 10^{231} \lor \neg \left(x \cdot y - z \cdot t \le 7.357670235460499077841315140089746402074 \cdot 10^{238}\right):\\ \;\;\;\;x \cdot \frac{y}{a} - t \cdot \frac{z}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot y}{a} - \frac{\frac{t \cdot z}{\sqrt[3]{a} \cdot \sqrt[3]{a}}}{\sqrt[3]{a}}\\ \end{array}\]
\frac{x \cdot y - z \cdot t}{a}
\begin{array}{l}
\mathbf{if}\;x \cdot y - z \cdot t \le -1.703235287902862224100755201234564323846 \cdot 10^{231} \lor \neg \left(x \cdot y - z \cdot t \le 7.357670235460499077841315140089746402074 \cdot 10^{238}\right):\\
\;\;\;\;x \cdot \frac{y}{a} - t \cdot \frac{z}{a}\\

\mathbf{else}:\\
\;\;\;\;\frac{x \cdot y}{a} - \frac{\frac{t \cdot z}{\sqrt[3]{a} \cdot \sqrt[3]{a}}}{\sqrt[3]{a}}\\

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r550580 = x;
        double r550581 = y;
        double r550582 = r550580 * r550581;
        double r550583 = z;
        double r550584 = t;
        double r550585 = r550583 * r550584;
        double r550586 = r550582 - r550585;
        double r550587 = a;
        double r550588 = r550586 / r550587;
        return r550588;
}

double f(double x, double y, double z, double t, double a) {
        double r550589 = x;
        double r550590 = y;
        double r550591 = r550589 * r550590;
        double r550592 = z;
        double r550593 = t;
        double r550594 = r550592 * r550593;
        double r550595 = r550591 - r550594;
        double r550596 = -1.7032352879028622e+231;
        bool r550597 = r550595 <= r550596;
        double r550598 = 7.357670235460499e+238;
        bool r550599 = r550595 <= r550598;
        double r550600 = !r550599;
        bool r550601 = r550597 || r550600;
        double r550602 = a;
        double r550603 = r550590 / r550602;
        double r550604 = r550589 * r550603;
        double r550605 = r550592 / r550602;
        double r550606 = r550593 * r550605;
        double r550607 = r550604 - r550606;
        double r550608 = r550591 / r550602;
        double r550609 = r550593 * r550592;
        double r550610 = cbrt(r550602);
        double r550611 = r550610 * r550610;
        double r550612 = r550609 / r550611;
        double r550613 = r550612 / r550610;
        double r550614 = r550608 - r550613;
        double r550615 = r550601 ? r550607 : r550614;
        return r550615;
}

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.6
Target5.8
Herbie1.3
\[\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)) < -1.7032352879028622e+231 or 7.357670235460499e+238 < (- (* x y) (* z t))

    1. Initial program 35.6

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

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

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

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

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

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

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

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

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

    if -1.7032352879028622e+231 < (- (* x y) (* z t)) < 7.357670235460499e+238

    1. Initial program 0.9

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

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

      \[\leadsto \frac{x \cdot y}{a} - \color{blue}{\frac{t \cdot z}{a}}\]
    5. Using strategy rm
    6. Applied add-cube-cbrt1.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 associate-/r*1.4

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y - z \cdot t \le -1.703235287902862224100755201234564323846 \cdot 10^{231} \lor \neg \left(x \cdot y - z \cdot t \le 7.357670235460499077841315140089746402074 \cdot 10^{238}\right):\\ \;\;\;\;x \cdot \frac{y}{a} - t \cdot \frac{z}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot y}{a} - \frac{\frac{t \cdot z}{\sqrt[3]{a} \cdot \sqrt[3]{a}}}{\sqrt[3]{a}}\\ \end{array}\]

Reproduce

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