Average Error: 7.3 → 4.5
Time: 4.0s
Precision: 64
\[\frac{x \cdot y - z \cdot t}{a}\]
\[\begin{array}{l} \mathbf{if}\;x \cdot y = -\infty:\\ \;\;\;\;\frac{x}{\frac{a}{y}} - \frac{t \cdot z}{a}\\ \mathbf{elif}\;x \cdot y \le -1.1849750715225054 \cdot 10^{105}:\\ \;\;\;\;\frac{x \cdot y}{a} - t \cdot \left(z \cdot \frac{1}{a}\right)\\ \mathbf{elif}\;x \cdot y \le 1.6232732567890361 \cdot 10^{76}:\\ \;\;\;\;\frac{x \cdot y}{a} - \left(t \cdot z\right) \cdot \frac{1}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{\frac{a}{y}} - \frac{t \cdot z}{a}\\ \end{array}\]
\frac{x \cdot y - z \cdot t}{a}
\begin{array}{l}
\mathbf{if}\;x \cdot y = -\infty:\\
\;\;\;\;\frac{x}{\frac{a}{y}} - \frac{t \cdot z}{a}\\

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

\mathbf{elif}\;x \cdot y \le 1.6232732567890361 \cdot 10^{76}:\\
\;\;\;\;\frac{x \cdot y}{a} - \left(t \cdot z\right) \cdot \frac{1}{a}\\

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r697847 = x;
        double r697848 = y;
        double r697849 = r697847 * r697848;
        double r697850 = z;
        double r697851 = t;
        double r697852 = r697850 * r697851;
        double r697853 = r697849 - r697852;
        double r697854 = a;
        double r697855 = r697853 / r697854;
        return r697855;
}

double f(double x, double y, double z, double t, double a) {
        double r697856 = x;
        double r697857 = y;
        double r697858 = r697856 * r697857;
        double r697859 = -inf.0;
        bool r697860 = r697858 <= r697859;
        double r697861 = a;
        double r697862 = r697861 / r697857;
        double r697863 = r697856 / r697862;
        double r697864 = t;
        double r697865 = z;
        double r697866 = r697864 * r697865;
        double r697867 = r697866 / r697861;
        double r697868 = r697863 - r697867;
        double r697869 = -1.1849750715225054e+105;
        bool r697870 = r697858 <= r697869;
        double r697871 = r697858 / r697861;
        double r697872 = 1.0;
        double r697873 = r697872 / r697861;
        double r697874 = r697865 * r697873;
        double r697875 = r697864 * r697874;
        double r697876 = r697871 - r697875;
        double r697877 = 1.623273256789036e+76;
        bool r697878 = r697858 <= r697877;
        double r697879 = r697866 * r697873;
        double r697880 = r697871 - r697879;
        double r697881 = r697878 ? r697880 : r697868;
        double r697882 = r697870 ? r697876 : r697881;
        double r697883 = r697860 ? r697868 : r697882;
        return r697883;
}

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.3
Target5.6
Herbie4.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 3 regimes
  2. if (* x y) < -inf.0 or 1.623273256789036e+76 < (* x y)

    1. Initial program 23.8

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

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

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

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

    if -inf.0 < (* x y) < -1.1849750715225054e+105

    1. Initial program 4.4

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

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

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

      \[\leadsto \frac{x \cdot y}{a} - \color{blue}{\left(t \cdot z\right) \cdot \frac{1}{a}}\]
    7. Using strategy rm
    8. Applied associate-*l*1.5

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

    if -1.1849750715225054e+105 < (* x y) < 1.623273256789036e+76

    1. Initial program 4.0

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y = -\infty:\\ \;\;\;\;\frac{x}{\frac{a}{y}} - \frac{t \cdot z}{a}\\ \mathbf{elif}\;x \cdot y \le -1.1849750715225054 \cdot 10^{105}:\\ \;\;\;\;\frac{x \cdot y}{a} - t \cdot \left(z \cdot \frac{1}{a}\right)\\ \mathbf{elif}\;x \cdot y \le 1.6232732567890361 \cdot 10^{76}:\\ \;\;\;\;\frac{x \cdot y}{a} - \left(t \cdot z\right) \cdot \frac{1}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{\frac{a}{y}} - \frac{t \cdot z}{a}\\ \end{array}\]

Reproduce

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