Average Error: 26.5 → 18.0
Time: 15.9s
Precision: 64
\[\frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{\left(x + t\right) + y}\]
\[\begin{array}{l} \mathbf{if}\;a \le -4.3473990959534402764208566333360926031 \cdot 10^{77} \lor \neg \left(a \le -3.937317057993329361148574628999906763686 \cdot 10^{-300}\right) \land \left(a \le 7.190504744030888873233099096412658089532 \cdot 10^{-167} \lor \neg \left(a \le 639976741042962656679682639921152\right)\right):\\ \;\;\;\;\left(z + a\right) - \frac{b}{y + \left(t + x\right)} \cdot y\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(x + y\right) \cdot z + a \cdot \left(y + t\right)}{x + \left(y + t\right)} - \frac{1}{\frac{y + \left(t + x\right)}{y}} \cdot b\\ \end{array}\]
\frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{\left(x + t\right) + y}
\begin{array}{l}
\mathbf{if}\;a \le -4.3473990959534402764208566333360926031 \cdot 10^{77} \lor \neg \left(a \le -3.937317057993329361148574628999906763686 \cdot 10^{-300}\right) \land \left(a \le 7.190504744030888873233099096412658089532 \cdot 10^{-167} \lor \neg \left(a \le 639976741042962656679682639921152\right)\right):\\
\;\;\;\;\left(z + a\right) - \frac{b}{y + \left(t + x\right)} \cdot y\\

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

\end{array}
double f(double x, double y, double z, double t, double a, double b) {
        double r751014 = x;
        double r751015 = y;
        double r751016 = r751014 + r751015;
        double r751017 = z;
        double r751018 = r751016 * r751017;
        double r751019 = t;
        double r751020 = r751019 + r751015;
        double r751021 = a;
        double r751022 = r751020 * r751021;
        double r751023 = r751018 + r751022;
        double r751024 = b;
        double r751025 = r751015 * r751024;
        double r751026 = r751023 - r751025;
        double r751027 = r751014 + r751019;
        double r751028 = r751027 + r751015;
        double r751029 = r751026 / r751028;
        return r751029;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r751030 = a;
        double r751031 = -4.3473990959534403e+77;
        bool r751032 = r751030 <= r751031;
        double r751033 = -3.9373170579933294e-300;
        bool r751034 = r751030 <= r751033;
        double r751035 = !r751034;
        double r751036 = 7.190504744030889e-167;
        bool r751037 = r751030 <= r751036;
        double r751038 = 6.3997674104296266e+32;
        bool r751039 = r751030 <= r751038;
        double r751040 = !r751039;
        bool r751041 = r751037 || r751040;
        bool r751042 = r751035 && r751041;
        bool r751043 = r751032 || r751042;
        double r751044 = z;
        double r751045 = r751044 + r751030;
        double r751046 = b;
        double r751047 = y;
        double r751048 = t;
        double r751049 = x;
        double r751050 = r751048 + r751049;
        double r751051 = r751047 + r751050;
        double r751052 = r751046 / r751051;
        double r751053 = r751052 * r751047;
        double r751054 = r751045 - r751053;
        double r751055 = r751049 + r751047;
        double r751056 = r751055 * r751044;
        double r751057 = r751047 + r751048;
        double r751058 = r751030 * r751057;
        double r751059 = r751056 + r751058;
        double r751060 = r751049 + r751057;
        double r751061 = r751059 / r751060;
        double r751062 = 1.0;
        double r751063 = r751051 / r751047;
        double r751064 = r751062 / r751063;
        double r751065 = r751064 * r751046;
        double r751066 = r751061 - r751065;
        double r751067 = r751043 ? r751054 : r751066;
        return r751067;
}

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

Original26.5
Target11.0
Herbie18.0
\[\begin{array}{l} \mathbf{if}\;\frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{\left(x + t\right) + y} \lt -3.581311708415056427521064305370896655752 \cdot 10^{153}:\\ \;\;\;\;\left(z + a\right) - b\\ \mathbf{elif}\;\frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{\left(x + t\right) + y} \lt 1.228596430831560895857110658734089400289 \cdot 10^{82}:\\ \;\;\;\;\frac{1}{\frac{\left(x + t\right) + y}{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}}\\ \mathbf{else}:\\ \;\;\;\;\left(z + a\right) - b\\ \end{array}\]

Derivation

  1. Split input into 2 regimes
  2. if a < -4.3473990959534403e+77 or -3.9373170579933294e-300 < a < 7.190504744030889e-167 or 6.3997674104296266e+32 < a

    1. Initial program 33.2

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

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

      \[\leadsto \color{blue}{\frac{\left(y + t\right) \cdot a + \left(y + x\right) \cdot z}{x + \left(y + t\right)}} - \frac{y \cdot b}{\left(x + t\right) + y}\]
    5. Simplified31.6

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

      \[\leadsto \color{blue}{\left(a + z\right)} - \frac{b}{\frac{x + \left(y + t\right)}{y}}\]
    7. Using strategy rm
    8. Applied *-un-lft-identity19.9

      \[\leadsto \left(a + z\right) - \frac{b}{\frac{x + \left(y + t\right)}{\color{blue}{1 \cdot y}}}\]
    9. Applied *-un-lft-identity19.9

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

      \[\leadsto \left(a + z\right) - \frac{b}{\color{blue}{\frac{1}{1} \cdot \frac{x + \left(y + t\right)}{y}}}\]
    11. Applied *-un-lft-identity19.9

      \[\leadsto \left(a + z\right) - \frac{\color{blue}{1 \cdot b}}{\frac{1}{1} \cdot \frac{x + \left(y + t\right)}{y}}\]
    12. Applied times-frac19.9

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

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

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

    if -4.3473990959534403e+77 < a < -3.9373170579933294e-300 or 7.190504744030889e-167 < a < 6.3997674104296266e+32

    1. Initial program 19.0

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

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

      \[\leadsto \color{blue}{\frac{\left(y + t\right) \cdot a + \left(y + x\right) \cdot z}{x + \left(y + t\right)}} - \frac{y \cdot b}{\left(x + t\right) + y}\]
    5. Simplified14.8

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \le -4.3473990959534402764208566333360926031 \cdot 10^{77} \lor \neg \left(a \le -3.937317057993329361148574628999906763686 \cdot 10^{-300}\right) \land \left(a \le 7.190504744030888873233099096412658089532 \cdot 10^{-167} \lor \neg \left(a \le 639976741042962656679682639921152\right)\right):\\ \;\;\;\;\left(z + a\right) - \frac{b}{y + \left(t + x\right)} \cdot y\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(x + y\right) \cdot z + a \cdot \left(y + t\right)}{x + \left(y + t\right)} - \frac{1}{\frac{y + \left(t + x\right)}{y}} \cdot b\\ \end{array}\]

Reproduce

herbie shell --seed 2019194 
(FPCore (x y z t a b)
  :name "AI.Clustering.Hierarchical.Internal:ward from clustering-0.2.1"

  :herbie-target
  (if (< (/ (- (+ (* (+ x y) z) (* (+ t y) a)) (* y b)) (+ (+ x t) y)) -3.5813117084150564e+153) (- (+ z a) b) (if (< (/ (- (+ (* (+ x y) z) (* (+ t y) a)) (* y b)) (+ (+ x t) y)) 1.2285964308315609e+82) (/ 1.0 (/ (+ (+ x t) y) (- (+ (* (+ x y) z) (* (+ t y) a)) (* y b)))) (- (+ z a) b)))

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