Average Error: 7.7 → 7.1
Time: 15.0s
Precision: 64
\[\frac{x \cdot y - z \cdot t}{a}\]
\[\begin{array}{l} \mathbf{if}\;x \cdot y - z \cdot t = -\infty:\\ \;\;\;\;\frac{\frac{x}{{a}^{\frac{2}{3}}} \cdot y - \frac{z \cdot t}{{a}^{\frac{2}{3}}}}{\sqrt[3]{a}}\\ \mathbf{else}:\\ \;\;\;\;\frac{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 = -\infty:\\
\;\;\;\;\frac{\frac{x}{{a}^{\frac{2}{3}}} \cdot y - \frac{z \cdot t}{{a}^{\frac{2}{3}}}}{\sqrt[3]{a}}\\

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r694675 = x;
        double r694676 = y;
        double r694677 = r694675 * r694676;
        double r694678 = z;
        double r694679 = t;
        double r694680 = r694678 * r694679;
        double r694681 = r694677 - r694680;
        double r694682 = a;
        double r694683 = r694681 / r694682;
        return r694683;
}

double f(double x, double y, double z, double t, double a) {
        double r694684 = x;
        double r694685 = y;
        double r694686 = r694684 * r694685;
        double r694687 = z;
        double r694688 = t;
        double r694689 = r694687 * r694688;
        double r694690 = r694686 - r694689;
        double r694691 = -inf.0;
        bool r694692 = r694690 <= r694691;
        double r694693 = a;
        double r694694 = 0.6666666666666666;
        double r694695 = pow(r694693, r694694);
        double r694696 = r694684 / r694695;
        double r694697 = r694696 * r694685;
        double r694698 = r694689 / r694695;
        double r694699 = r694697 - r694698;
        double r694700 = cbrt(r694693);
        double r694701 = r694699 / r694700;
        double r694702 = r694690 / r694693;
        double r694703 = r694692 ? r694701 : r694702;
        return r694703;
}

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.5
Herbie7.1
\[\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)) < -inf.0

    1. Initial program 64.0

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

      \[\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*64.0

      \[\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-sub64.0

      \[\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. Simplified53.1

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

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

    if -inf.0 < (- (* x y) (* z t))

    1. Initial program 4.4

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y - z \cdot t = -\infty:\\ \;\;\;\;\frac{\frac{x}{{a}^{\frac{2}{3}}} \cdot y - \frac{z \cdot t}{{a}^{\frac{2}{3}}}}{\sqrt[3]{a}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot y - z \cdot t}{a}\\ \end{array}\]

Reproduce

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