Average Error: 7.4 → 2.5
Time: 3.3s
Precision: 64
\[\frac{x \cdot y - z \cdot t}{a}\]
\[\begin{array}{l} \mathbf{if}\;x \cdot y - z \cdot t \le -2.3081193531529197 \cdot 10^{92} \lor \neg \left(x \cdot y - z \cdot t \le 3.38424699368821546 \cdot 10^{194}\right):\\ \;\;\;\;x \cdot \frac{y}{a} - \frac{1}{\frac{\frac{a}{z}}{t}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(\sqrt[3]{x \cdot y - z \cdot t} \cdot \sqrt[3]{x \cdot y - z \cdot t}\right) \cdot \sqrt[3]{x \cdot y - z \cdot t}}{a}\\ \end{array}\]
\frac{x \cdot y - z \cdot t}{a}
\begin{array}{l}
\mathbf{if}\;x \cdot y - z \cdot t \le -2.3081193531529197 \cdot 10^{92} \lor \neg \left(x \cdot y - z \cdot t \le 3.38424699368821546 \cdot 10^{194}\right):\\
\;\;\;\;x \cdot \frac{y}{a} - \frac{1}{\frac{\frac{a}{z}}{t}}\\

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r731292 = x;
        double r731293 = y;
        double r731294 = r731292 * r731293;
        double r731295 = z;
        double r731296 = t;
        double r731297 = r731295 * r731296;
        double r731298 = r731294 - r731297;
        double r731299 = a;
        double r731300 = r731298 / r731299;
        return r731300;
}

double f(double x, double y, double z, double t, double a) {
        double r731301 = x;
        double r731302 = y;
        double r731303 = r731301 * r731302;
        double r731304 = z;
        double r731305 = t;
        double r731306 = r731304 * r731305;
        double r731307 = r731303 - r731306;
        double r731308 = -2.3081193531529197e+92;
        bool r731309 = r731307 <= r731308;
        double r731310 = 3.3842469936882155e+194;
        bool r731311 = r731307 <= r731310;
        double r731312 = !r731311;
        bool r731313 = r731309 || r731312;
        double r731314 = a;
        double r731315 = r731302 / r731314;
        double r731316 = r731301 * r731315;
        double r731317 = 1.0;
        double r731318 = r731314 / r731304;
        double r731319 = r731318 / r731305;
        double r731320 = r731317 / r731319;
        double r731321 = r731316 - r731320;
        double r731322 = cbrt(r731307);
        double r731323 = r731322 * r731322;
        double r731324 = r731323 * r731322;
        double r731325 = r731324 / r731314;
        double r731326 = r731313 ? r731321 : r731325;
        return r731326;
}

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.4
Target6.0
Herbie2.5
\[\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)) < -2.3081193531529197e+92 or 3.3842469936882155e+194 < (- (* x y) (* z t))

    1. Initial program 19.5

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

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

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

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

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

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

      \[\leadsto \color{blue}{x} \cdot \frac{y}{a} - \frac{t}{\frac{a}{z}}\]
    11. Using strategy rm
    12. Applied clear-num3.7

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

    if -2.3081193531529197e+92 < (- (* x y) (* z t)) < 3.3842469936882155e+194

    1. Initial program 0.9

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

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

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

Reproduce

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