Average Error: 7.2 → 1.5
Time: 14.6s
Precision: 64
\[\frac{x \cdot y - z \cdot t}{a}\]
\[\begin{array}{l} \mathbf{if}\;x \cdot y - z \cdot t \le -1.8024824825198777 \cdot 10^{+302}:\\ \;\;\;\;\frac{x}{a} \cdot y - \frac{z}{\frac{a}{t}}\\ \mathbf{elif}\;x \cdot y - z \cdot t \le 5.651609034233614 \cdot 10^{+105}:\\ \;\;\;\;\frac{t \cdot \left(-z\right)}{a} + \frac{x \cdot y}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{a} \cdot y - \frac{z}{\frac{a}{t}}\\ \end{array}\]
\frac{x \cdot y - z \cdot t}{a}
\begin{array}{l}
\mathbf{if}\;x \cdot y - z \cdot t \le -1.8024824825198777 \cdot 10^{+302}:\\
\;\;\;\;\frac{x}{a} \cdot y - \frac{z}{\frac{a}{t}}\\

\mathbf{elif}\;x \cdot y - z \cdot t \le 5.651609034233614 \cdot 10^{+105}:\\
\;\;\;\;\frac{t \cdot \left(-z\right)}{a} + \frac{x \cdot y}{a}\\

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r41214094 = x;
        double r41214095 = y;
        double r41214096 = r41214094 * r41214095;
        double r41214097 = z;
        double r41214098 = t;
        double r41214099 = r41214097 * r41214098;
        double r41214100 = r41214096 - r41214099;
        double r41214101 = a;
        double r41214102 = r41214100 / r41214101;
        return r41214102;
}

double f(double x, double y, double z, double t, double a) {
        double r41214103 = x;
        double r41214104 = y;
        double r41214105 = r41214103 * r41214104;
        double r41214106 = z;
        double r41214107 = t;
        double r41214108 = r41214106 * r41214107;
        double r41214109 = r41214105 - r41214108;
        double r41214110 = -1.8024824825198777e+302;
        bool r41214111 = r41214109 <= r41214110;
        double r41214112 = a;
        double r41214113 = r41214103 / r41214112;
        double r41214114 = r41214113 * r41214104;
        double r41214115 = r41214112 / r41214107;
        double r41214116 = r41214106 / r41214115;
        double r41214117 = r41214114 - r41214116;
        double r41214118 = 5.651609034233614e+105;
        bool r41214119 = r41214109 <= r41214118;
        double r41214120 = -r41214106;
        double r41214121 = r41214107 * r41214120;
        double r41214122 = r41214121 / r41214112;
        double r41214123 = r41214105 / r41214112;
        double r41214124 = r41214122 + r41214123;
        double r41214125 = r41214119 ? r41214124 : r41214117;
        double r41214126 = r41214111 ? r41214117 : r41214125;
        return r41214126;
}

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.2
Target5.6
Herbie1.5
\[\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.8024824825198777e+302 or 5.651609034233614e+105 < (- (* x y) (* z t))

    1. Initial program 25.0

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

      \[\leadsto \color{blue}{\frac{x \cdot y}{a} - \frac{z \cdot t}{a}}\]
    4. Using strategy rm
    5. Applied sub-neg25.0

      \[\leadsto \color{blue}{\frac{x \cdot y}{a} + \left(-\frac{z \cdot t}{a}\right)}\]
    6. Using strategy rm
    7. Applied *-un-lft-identity25.0

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

      \[\leadsto \color{blue}{1 \cdot \frac{x \cdot y}{a}} + 1 \cdot \left(-\frac{z \cdot t}{a}\right)\]
    9. Applied distribute-lft-out25.0

      \[\leadsto \color{blue}{1 \cdot \left(\frac{x \cdot y}{a} + \left(-\frac{z \cdot t}{a}\right)\right)}\]
    10. Simplified3.1

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

    if -1.8024824825198777e+302 < (- (* x y) (* z t)) < 5.651609034233614e+105

    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. Using strategy rm
    5. Applied sub-neg0.9

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y - z \cdot t \le -1.8024824825198777 \cdot 10^{+302}:\\ \;\;\;\;\frac{x}{a} \cdot y - \frac{z}{\frac{a}{t}}\\ \mathbf{elif}\;x \cdot y - z \cdot t \le 5.651609034233614 \cdot 10^{+105}:\\ \;\;\;\;\frac{t \cdot \left(-z\right)}{a} + \frac{x \cdot y}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{a} \cdot y - \frac{z}{\frac{a}{t}}\\ \end{array}\]

Reproduce

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