Average Error: 23.1 → 19.1
Time: 17.4s
Precision: 64
\[\frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)}\]
\[\begin{array}{l} \mathbf{if}\;z \le -4.812224200595293507689589697171458927979 \cdot 10^{164} \lor \neg \left(z \le 1.500183368090720918883242645080141003947 \cdot 10^{85}\right):\\ \;\;\;\;\frac{t}{b} - \frac{a}{b}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(t - a\right) \cdot z + y \cdot x}{z \cdot \left(b - y\right) + y}\\ \end{array}\]
\frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)}
\begin{array}{l}
\mathbf{if}\;z \le -4.812224200595293507689589697171458927979 \cdot 10^{164} \lor \neg \left(z \le 1.500183368090720918883242645080141003947 \cdot 10^{85}\right):\\
\;\;\;\;\frac{t}{b} - \frac{a}{b}\\

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

\end{array}
double f(double x, double y, double z, double t, double a, double b) {
        double r615057 = x;
        double r615058 = y;
        double r615059 = r615057 * r615058;
        double r615060 = z;
        double r615061 = t;
        double r615062 = a;
        double r615063 = r615061 - r615062;
        double r615064 = r615060 * r615063;
        double r615065 = r615059 + r615064;
        double r615066 = b;
        double r615067 = r615066 - r615058;
        double r615068 = r615060 * r615067;
        double r615069 = r615058 + r615068;
        double r615070 = r615065 / r615069;
        return r615070;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r615071 = z;
        double r615072 = -4.812224200595294e+164;
        bool r615073 = r615071 <= r615072;
        double r615074 = 1.500183368090721e+85;
        bool r615075 = r615071 <= r615074;
        double r615076 = !r615075;
        bool r615077 = r615073 || r615076;
        double r615078 = t;
        double r615079 = b;
        double r615080 = r615078 / r615079;
        double r615081 = a;
        double r615082 = r615081 / r615079;
        double r615083 = r615080 - r615082;
        double r615084 = r615078 - r615081;
        double r615085 = r615084 * r615071;
        double r615086 = y;
        double r615087 = x;
        double r615088 = r615086 * r615087;
        double r615089 = r615085 + r615088;
        double r615090 = r615079 - r615086;
        double r615091 = r615071 * r615090;
        double r615092 = r615091 + r615086;
        double r615093 = r615089 / r615092;
        double r615094 = r615077 ? r615083 : r615093;
        return r615094;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Bits error versus a

Bits error versus b

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original23.1
Target17.9
Herbie19.1
\[\frac{z \cdot t + y \cdot x}{y + z \cdot \left(b - y\right)} - \frac{a}{\left(b - y\right) + \frac{y}{z}}\]

Derivation

  1. Split input into 2 regimes
  2. if z < -4.812224200595294e+164 or 1.500183368090721e+85 < z

    1. Initial program 48.3

      \[\frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)}\]
    2. Using strategy rm
    3. Applied clear-num48.3

      \[\leadsto \color{blue}{\frac{1}{\frac{y + z \cdot \left(b - y\right)}{x \cdot y + z \cdot \left(t - a\right)}}}\]
    4. Simplified48.3

      \[\leadsto \frac{1}{\color{blue}{\frac{z \cdot \left(b - y\right) + y}{z \cdot \left(t - a\right) + x \cdot y}}}\]
    5. Taylor expanded around inf 34.0

      \[\leadsto \color{blue}{\frac{t}{b} - \frac{a}{b}}\]

    if -4.812224200595294e+164 < z < 1.500183368090721e+85

    1. Initial program 13.2

      \[\frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)}\]
    2. Using strategy rm
    3. Applied clear-num13.3

      \[\leadsto \color{blue}{\frac{1}{\frac{y + z \cdot \left(b - y\right)}{x \cdot y + z \cdot \left(t - a\right)}}}\]
    4. Simplified13.3

      \[\leadsto \frac{1}{\color{blue}{\frac{z \cdot \left(b - y\right) + y}{z \cdot \left(t - a\right) + x \cdot y}}}\]
    5. Using strategy rm
    6. Applied div-inv13.4

      \[\leadsto \frac{1}{\color{blue}{\left(z \cdot \left(b - y\right) + y\right) \cdot \frac{1}{z \cdot \left(t - a\right) + x \cdot y}}}\]
    7. Simplified13.4

      \[\leadsto \frac{1}{\left(z \cdot \left(b - y\right) + y\right) \cdot \color{blue}{\frac{1}{x \cdot y + \left(t - a\right) \cdot z}}}\]
    8. Using strategy rm
    9. Applied div-inv13.4

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \le -4.812224200595293507689589697171458927979 \cdot 10^{164} \lor \neg \left(z \le 1.500183368090720918883242645080141003947 \cdot 10^{85}\right):\\ \;\;\;\;\frac{t}{b} - \frac{a}{b}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(t - a\right) \cdot z + y \cdot x}{z \cdot \left(b - y\right) + y}\\ \end{array}\]

Reproduce

herbie shell --seed 2019179 
(FPCore (x y z t a b)
  :name "Development.Shake.Progress:decay from shake-0.15.5"

  :herbie-target
  (- (/ (+ (* z t) (* y x)) (+ y (* z (- b y)))) (/ a (+ (- b y) (/ y z))))

  (/ (+ (* x y) (* z (- t a))) (+ y (* z (- b y)))))