Average Error: 7.7 → 2.2
Time: 19.0s
Precision: 64
\[\frac{x \cdot y - z \cdot t}{a}\]
\[\begin{array}{l} \mathbf{if}\;x \cdot y - z \cdot t \le -5.672988066853380499272591542768303552197 \cdot 10^{151}:\\ \;\;\;\;\frac{x}{\frac{a}{y}} - z \cdot \frac{t}{a}\\ \mathbf{elif}\;x \cdot y - z \cdot t \le 2.560348681674806982161079926590341946882 \cdot 10^{214}:\\ \;\;\;\;\frac{x \cdot \left(\sqrt[3]{y} \cdot \sqrt[3]{y}\right)}{\frac{a}{\sqrt[3]{y}}} - \frac{z \cdot t}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{\frac{a}{y}} - z \cdot \frac{t}{a}\\ \end{array}\]
\frac{x \cdot y - z \cdot t}{a}
\begin{array}{l}
\mathbf{if}\;x \cdot y - z \cdot t \le -5.672988066853380499272591542768303552197 \cdot 10^{151}:\\
\;\;\;\;\frac{x}{\frac{a}{y}} - z \cdot \frac{t}{a}\\

\mathbf{elif}\;x \cdot y - z \cdot t \le 2.560348681674806982161079926590341946882 \cdot 10^{214}:\\
\;\;\;\;\frac{x \cdot \left(\sqrt[3]{y} \cdot \sqrt[3]{y}\right)}{\frac{a}{\sqrt[3]{y}}} - \frac{z \cdot t}{a}\\

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r213151622 = x;
        double r213151623 = y;
        double r213151624 = r213151622 * r213151623;
        double r213151625 = z;
        double r213151626 = t;
        double r213151627 = r213151625 * r213151626;
        double r213151628 = r213151624 - r213151627;
        double r213151629 = a;
        double r213151630 = r213151628 / r213151629;
        return r213151630;
}

double f(double x, double y, double z, double t, double a) {
        double r213151631 = x;
        double r213151632 = y;
        double r213151633 = r213151631 * r213151632;
        double r213151634 = z;
        double r213151635 = t;
        double r213151636 = r213151634 * r213151635;
        double r213151637 = r213151633 - r213151636;
        double r213151638 = -5.67298806685338e+151;
        bool r213151639 = r213151637 <= r213151638;
        double r213151640 = a;
        double r213151641 = r213151640 / r213151632;
        double r213151642 = r213151631 / r213151641;
        double r213151643 = r213151635 / r213151640;
        double r213151644 = r213151634 * r213151643;
        double r213151645 = r213151642 - r213151644;
        double r213151646 = 2.560348681674807e+214;
        bool r213151647 = r213151637 <= r213151646;
        double r213151648 = cbrt(r213151632);
        double r213151649 = r213151648 * r213151648;
        double r213151650 = r213151631 * r213151649;
        double r213151651 = r213151640 / r213151648;
        double r213151652 = r213151650 / r213151651;
        double r213151653 = r213151636 / r213151640;
        double r213151654 = r213151652 - r213151653;
        double r213151655 = r213151647 ? r213151654 : r213151645;
        double r213151656 = r213151639 ? r213151645 : r213151655;
        return r213151656;
}

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.7
Target6.0
Herbie2.2
\[\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)) < -5.67298806685338e+151 or 2.560348681674807e+214 < (- (* x y) (* z t))

    1. Initial program 25.3

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

      \[\leadsto \color{blue}{\frac{x \cdot y}{a} - \frac{z \cdot t}{a}}\]
    4. Using strategy rm
    5. Applied associate-/l*13.5

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

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

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

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

    if -5.67298806685338e+151 < (- (* x y) (* z t)) < 2.560348681674807e+214

    1. Initial program 1.0

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

      \[\leadsto \color{blue}{\frac{x \cdot y}{a} - \frac{z \cdot t}{a}}\]
    4. Using strategy rm
    5. Applied associate-/l*5.7

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

      \[\leadsto \frac{x}{\frac{a}{\color{blue}{\left(\sqrt[3]{y} \cdot \sqrt[3]{y}\right) \cdot \sqrt[3]{y}}}} - \frac{z \cdot t}{a}\]
    8. Applied *-un-lft-identity6.1

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

      \[\leadsto \frac{x}{\color{blue}{\frac{1}{\sqrt[3]{y} \cdot \sqrt[3]{y}} \cdot \frac{a}{\sqrt[3]{y}}}} - \frac{z \cdot t}{a}\]
    10. Applied associate-/r*2.4

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y - z \cdot t \le -5.672988066853380499272591542768303552197 \cdot 10^{151}:\\ \;\;\;\;\frac{x}{\frac{a}{y}} - z \cdot \frac{t}{a}\\ \mathbf{elif}\;x \cdot y - z \cdot t \le 2.560348681674806982161079926590341946882 \cdot 10^{214}:\\ \;\;\;\;\frac{x \cdot \left(\sqrt[3]{y} \cdot \sqrt[3]{y}\right)}{\frac{a}{\sqrt[3]{y}}} - \frac{z \cdot t}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{\frac{a}{y}} - z \cdot \frac{t}{a}\\ \end{array}\]

Reproduce

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

  :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))