Average Error: 7.8 → 0.8
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 -3.78878154666729648028756748998228310304 \cdot 10^{207} \lor \neg \left(x \cdot y - z \cdot t \le -7.184454030855425458741927392588250354613 \cdot 10^{-77} \lor \neg \left(x \cdot y - z \cdot t \le 0.0 \lor \neg \left(x \cdot y - z \cdot t \le 6.902976578749531265225690058079584054697 \cdot 10^{274}\right)\right)\right):\\ \;\;\;\;x \cdot \frac{y}{a} - \frac{t}{\frac{a}{z}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot y}{a} - \frac{t \cdot z}{a}\\ \end{array}\]
\frac{x \cdot y - z \cdot t}{a}
\begin{array}{l}
\mathbf{if}\;x \cdot y - z \cdot t \le -3.78878154666729648028756748998228310304 \cdot 10^{207} \lor \neg \left(x \cdot y - z \cdot t \le -7.184454030855425458741927392588250354613 \cdot 10^{-77} \lor \neg \left(x \cdot y - z \cdot t \le 0.0 \lor \neg \left(x \cdot y - z \cdot t \le 6.902976578749531265225690058079584054697 \cdot 10^{274}\right)\right)\right):\\
\;\;\;\;x \cdot \frac{y}{a} - \frac{t}{\frac{a}{z}}\\

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r811952 = x;
        double r811953 = y;
        double r811954 = r811952 * r811953;
        double r811955 = z;
        double r811956 = t;
        double r811957 = r811955 * r811956;
        double r811958 = r811954 - r811957;
        double r811959 = a;
        double r811960 = r811958 / r811959;
        return r811960;
}

double f(double x, double y, double z, double t, double a) {
        double r811961 = x;
        double r811962 = y;
        double r811963 = r811961 * r811962;
        double r811964 = z;
        double r811965 = t;
        double r811966 = r811964 * r811965;
        double r811967 = r811963 - r811966;
        double r811968 = -3.7887815466672965e+207;
        bool r811969 = r811967 <= r811968;
        double r811970 = -7.184454030855425e-77;
        bool r811971 = r811967 <= r811970;
        double r811972 = 0.0;
        bool r811973 = r811967 <= r811972;
        double r811974 = 6.902976578749531e+274;
        bool r811975 = r811967 <= r811974;
        double r811976 = !r811975;
        bool r811977 = r811973 || r811976;
        double r811978 = !r811977;
        bool r811979 = r811971 || r811978;
        double r811980 = !r811979;
        bool r811981 = r811969 || r811980;
        double r811982 = a;
        double r811983 = r811962 / r811982;
        double r811984 = r811961 * r811983;
        double r811985 = r811982 / r811964;
        double r811986 = r811965 / r811985;
        double r811987 = r811984 - r811986;
        double r811988 = r811963 / r811982;
        double r811989 = r811965 * r811964;
        double r811990 = r811989 / r811982;
        double r811991 = r811988 - r811990;
        double r811992 = r811981 ? r811987 : r811991;
        return r811992;
}

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.8
Target6.1
Herbie0.8
\[\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)) < -3.7887815466672965e+207 or -7.184454030855425e-77 < (- (* x y) (* z t)) < 0.0 or 6.902976578749531e+274 < (- (* x y) (* z t))

    1. Initial program 25.3

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

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

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

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

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

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

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

    if -3.7887815466672965e+207 < (- (* x y) (* z t)) < -7.184454030855425e-77 or 0.0 < (- (* x y) (* z t)) < 6.902976578749531e+274

    1. Initial program 0.5

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

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

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

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

      \[\leadsto \frac{x \cdot y}{a} - \color{blue}{1 \cdot \frac{t}{\frac{a}{z}}}\]
    9. Applied *-un-lft-identity5.8

      \[\leadsto \color{blue}{1 \cdot \frac{x \cdot y}{a}} - 1 \cdot \frac{t}{\frac{a}{z}}\]
    10. Applied distribute-lft-out--5.8

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y - z \cdot t \le -3.78878154666729648028756748998228310304 \cdot 10^{207} \lor \neg \left(x \cdot y - z \cdot t \le -7.184454030855425458741927392588250354613 \cdot 10^{-77} \lor \neg \left(x \cdot y - z \cdot t \le 0.0 \lor \neg \left(x \cdot y - z \cdot t \le 6.902976578749531265225690058079584054697 \cdot 10^{274}\right)\right)\right):\\ \;\;\;\;x \cdot \frac{y}{a} - \frac{t}{\frac{a}{z}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot y}{a} - \frac{t \cdot z}{a}\\ \end{array}\]

Reproduce

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