Average Error: 7.9 → 1.0
Time: 44.3s
Precision: 64
\[\frac{x \cdot y - z \cdot t}{a}\]
\[\begin{array}{l} \mathbf{if}\;x \cdot y - z \cdot t \le -1.6479465420907752 \cdot 10^{+185}:\\ \;\;\;\;\frac{y}{\frac{a}{x}} - \frac{t}{\frac{a}{z}}\\ \mathbf{elif}\;x \cdot y - z \cdot t \le 2.9626375528019777 \cdot 10^{+168}:\\ \;\;\;\;\frac{x \cdot y - z \cdot t}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{\frac{a}{x}} - \frac{t}{\frac{a}{z}}\\ \end{array}\]
\frac{x \cdot y - z \cdot t}{a}
\begin{array}{l}
\mathbf{if}\;x \cdot y - z \cdot t \le -1.6479465420907752 \cdot 10^{+185}:\\
\;\;\;\;\frac{y}{\frac{a}{x}} - \frac{t}{\frac{a}{z}}\\

\mathbf{elif}\;x \cdot y - z \cdot t \le 2.9626375528019777 \cdot 10^{+168}:\\
\;\;\;\;\frac{x \cdot y - z \cdot t}{a}\\

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r42178109 = x;
        double r42178110 = y;
        double r42178111 = r42178109 * r42178110;
        double r42178112 = z;
        double r42178113 = t;
        double r42178114 = r42178112 * r42178113;
        double r42178115 = r42178111 - r42178114;
        double r42178116 = a;
        double r42178117 = r42178115 / r42178116;
        return r42178117;
}

double f(double x, double y, double z, double t, double a) {
        double r42178118 = x;
        double r42178119 = y;
        double r42178120 = r42178118 * r42178119;
        double r42178121 = z;
        double r42178122 = t;
        double r42178123 = r42178121 * r42178122;
        double r42178124 = r42178120 - r42178123;
        double r42178125 = -1.6479465420907752e+185;
        bool r42178126 = r42178124 <= r42178125;
        double r42178127 = a;
        double r42178128 = r42178127 / r42178118;
        double r42178129 = r42178119 / r42178128;
        double r42178130 = r42178127 / r42178121;
        double r42178131 = r42178122 / r42178130;
        double r42178132 = r42178129 - r42178131;
        double r42178133 = 2.9626375528019777e+168;
        bool r42178134 = r42178124 <= r42178133;
        double r42178135 = r42178124 / r42178127;
        double r42178136 = r42178134 ? r42178135 : r42178132;
        double r42178137 = r42178126 ? r42178132 : r42178136;
        return r42178137;
}

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.2
Herbie1.0
\[\begin{array}{l} \mathbf{if}\;z \lt -2.468684968699548 \cdot 10^{+170}:\\ \;\;\;\;\frac{y}{a} \cdot x - \frac{t}{a} \cdot z\\ \mathbf{elif}\;z \lt 6.309831121978371 \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.6479465420907752e+185 or 2.9626375528019777e+168 < (- (* x y) (* z t))

    1. Initial program 25.6

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

      \[\leadsto \frac{x \cdot y - z \cdot t}{\color{blue}{\left(\sqrt[3]{a} \cdot \sqrt[3]{a}\right) \cdot \sqrt[3]{a}}}\]
    4. Applied associate-/r*26.2

      \[\leadsto \color{blue}{\frac{\frac{x \cdot y - z \cdot t}{\sqrt[3]{a} \cdot \sqrt[3]{a}}}{\sqrt[3]{a}}}\]
    5. Using strategy rm
    6. Applied div-sub26.2

      \[\leadsto \frac{\color{blue}{\frac{x \cdot y}{\sqrt[3]{a} \cdot \sqrt[3]{a}} - \frac{z \cdot t}{\sqrt[3]{a} \cdot \sqrt[3]{a}}}}{\sqrt[3]{a}}\]
    7. Applied div-sub26.2

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

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

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

    if -1.6479465420907752e+185 < (- (* x y) (* z t)) < 2.9626375528019777e+168

    1. Initial program 0.9

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y - z \cdot t \le -1.6479465420907752 \cdot 10^{+185}:\\ \;\;\;\;\frac{y}{\frac{a}{x}} - \frac{t}{\frac{a}{z}}\\ \mathbf{elif}\;x \cdot y - z \cdot t \le 2.9626375528019777 \cdot 10^{+168}:\\ \;\;\;\;\frac{x \cdot y - z \cdot t}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{\frac{a}{x}} - \frac{t}{\frac{a}{z}}\\ \end{array}\]

Reproduce

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