Average Error: 7.7 → 0.9
Time: 3.5s
Precision: 64
\[\frac{x \cdot y - z \cdot t}{a}\]
\[\begin{array}{l} \mathbf{if}\;x \cdot y - z \cdot t = -\infty \lor \neg \left(x \cdot y - z \cdot t \le 6.4828870249091608 \cdot 10^{293}\right):\\ \;\;\;\;\frac{x}{\sqrt[3]{a} \cdot \sqrt[3]{a}} \cdot \frac{y}{\sqrt[3]{a}} - t \cdot \frac{z}{a}\\ \mathbf{else}:\\ \;\;\;\;\left(x \cdot y - z \cdot t\right) \cdot \frac{1}{a}\\ \end{array}\]
\frac{x \cdot y - z \cdot t}{a}
\begin{array}{l}
\mathbf{if}\;x \cdot y - z \cdot t = -\infty \lor \neg \left(x \cdot y - z \cdot t \le 6.4828870249091608 \cdot 10^{293}\right):\\
\;\;\;\;\frac{x}{\sqrt[3]{a} \cdot \sqrt[3]{a}} \cdot \frac{y}{\sqrt[3]{a}} - t \cdot \frac{z}{a}\\

\mathbf{else}:\\
\;\;\;\;\left(x \cdot y - z \cdot t\right) \cdot \frac{1}{a}\\

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r785992 = x;
        double r785993 = y;
        double r785994 = r785992 * r785993;
        double r785995 = z;
        double r785996 = t;
        double r785997 = r785995 * r785996;
        double r785998 = r785994 - r785997;
        double r785999 = a;
        double r786000 = r785998 / r785999;
        return r786000;
}

double f(double x, double y, double z, double t, double a) {
        double r786001 = x;
        double r786002 = y;
        double r786003 = r786001 * r786002;
        double r786004 = z;
        double r786005 = t;
        double r786006 = r786004 * r786005;
        double r786007 = r786003 - r786006;
        double r786008 = -inf.0;
        bool r786009 = r786007 <= r786008;
        double r786010 = 6.482887024909161e+293;
        bool r786011 = r786007 <= r786010;
        double r786012 = !r786011;
        bool r786013 = r786009 || r786012;
        double r786014 = a;
        double r786015 = cbrt(r786014);
        double r786016 = r786015 * r786015;
        double r786017 = r786001 / r786016;
        double r786018 = r786002 / r786015;
        double r786019 = r786017 * r786018;
        double r786020 = r786004 / r786014;
        double r786021 = r786005 * r786020;
        double r786022 = r786019 - r786021;
        double r786023 = 1.0;
        double r786024 = r786023 / r786014;
        double r786025 = r786007 * r786024;
        double r786026 = r786013 ? r786022 : r786025;
        return r786026;
}

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
Target5.8
Herbie0.9
\[\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)) < -inf.0 or 6.482887024909161e+293 < (- (* x y) (* z t))

    1. Initial program 60.4

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

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

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

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

      \[\leadsto \color{blue}{\frac{x}{\sqrt[3]{a} \cdot \sqrt[3]{a}} \cdot \frac{y}{\sqrt[3]{a}}} - \frac{t \cdot z}{a}\]
    8. Using strategy rm
    9. Applied *-un-lft-identity34.0

      \[\leadsto \frac{x}{\sqrt[3]{a} \cdot \sqrt[3]{a}} \cdot \frac{y}{\sqrt[3]{a}} - \frac{t \cdot z}{\color{blue}{1 \cdot a}}\]
    10. Applied times-frac0.8

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

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

    if -inf.0 < (- (* x y) (* z t)) < 6.482887024909161e+293

    1. Initial program 0.8

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

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

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

Reproduce

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