Average Error: 7.1 → 3.5
Time: 17.6s
Precision: 64
\[\frac{x + \frac{y \cdot z - x}{t \cdot z - x}}{x + 1}\]
\[\begin{array}{l} \mathbf{if}\;z \le -8.114676354067779218146434366254066316571 \cdot 10^{166} \lor \neg \left(z \le 6.158470310373082749921667144051634464626 \cdot 10^{144}\right):\\ \;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\ \mathbf{else}:\\ \;\;\;\;\frac{x + \frac{\frac{1}{t \cdot z - x}}{\frac{1}{z \cdot y - x}}}{x + 1}\\ \end{array}\]
\frac{x + \frac{y \cdot z - x}{t \cdot z - x}}{x + 1}
\begin{array}{l}
\mathbf{if}\;z \le -8.114676354067779218146434366254066316571 \cdot 10^{166} \lor \neg \left(z \le 6.158470310373082749921667144051634464626 \cdot 10^{144}\right):\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\

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

\end{array}
double f(double x, double y, double z, double t) {
        double r529971 = x;
        double r529972 = y;
        double r529973 = z;
        double r529974 = r529972 * r529973;
        double r529975 = r529974 - r529971;
        double r529976 = t;
        double r529977 = r529976 * r529973;
        double r529978 = r529977 - r529971;
        double r529979 = r529975 / r529978;
        double r529980 = r529971 + r529979;
        double r529981 = 1.0;
        double r529982 = r529971 + r529981;
        double r529983 = r529980 / r529982;
        return r529983;
}

double f(double x, double y, double z, double t) {
        double r529984 = z;
        double r529985 = -8.114676354067779e+166;
        bool r529986 = r529984 <= r529985;
        double r529987 = 6.158470310373083e+144;
        bool r529988 = r529984 <= r529987;
        double r529989 = !r529988;
        bool r529990 = r529986 || r529989;
        double r529991 = x;
        double r529992 = y;
        double r529993 = t;
        double r529994 = r529992 / r529993;
        double r529995 = r529991 + r529994;
        double r529996 = 1.0;
        double r529997 = r529991 + r529996;
        double r529998 = r529995 / r529997;
        double r529999 = 1.0;
        double r530000 = r529993 * r529984;
        double r530001 = r530000 - r529991;
        double r530002 = r529999 / r530001;
        double r530003 = r529984 * r529992;
        double r530004 = r530003 - r529991;
        double r530005 = r529999 / r530004;
        double r530006 = r530002 / r530005;
        double r530007 = r529991 + r530006;
        double r530008 = r530007 / r529997;
        double r530009 = r529990 ? r529998 : r530008;
        return r530009;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original7.1
Target0.2
Herbie3.5
\[\frac{x + \left(\frac{y}{t - \frac{x}{z}} - \frac{x}{t \cdot z - x}\right)}{x + 1}\]

Derivation

  1. Split input into 2 regimes
  2. if z < -8.114676354067779e+166 or 6.158470310373083e+144 < z

    1. Initial program 21.5

      \[\frac{x + \frac{y \cdot z - x}{t \cdot z - x}}{x + 1}\]
    2. Taylor expanded around inf 6.9

      \[\leadsto \frac{x + \color{blue}{\frac{y}{t}}}{x + 1}\]

    if -8.114676354067779e+166 < z < 6.158470310373083e+144

    1. Initial program 2.4

      \[\frac{x + \frac{y \cdot z - x}{t \cdot z - x}}{x + 1}\]
    2. Using strategy rm
    3. Applied clear-num2.5

      \[\leadsto \frac{x + \color{blue}{\frac{1}{\frac{t \cdot z - x}{y \cdot z - x}}}}{x + 1}\]
    4. Simplified2.5

      \[\leadsto \frac{x + \frac{1}{\color{blue}{\frac{t \cdot z - x}{z \cdot y - x}}}}{x + 1}\]
    5. Using strategy rm
    6. Applied div-inv2.5

      \[\leadsto \frac{x + \frac{1}{\color{blue}{\left(t \cdot z - x\right) \cdot \frac{1}{z \cdot y - x}}}}{x + 1}\]
    7. Applied associate-/r*2.5

      \[\leadsto \frac{x + \color{blue}{\frac{\frac{1}{t \cdot z - x}}{\frac{1}{z \cdot y - x}}}}{x + 1}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification3.5

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \le -8.114676354067779218146434366254066316571 \cdot 10^{166} \lor \neg \left(z \le 6.158470310373082749921667144051634464626 \cdot 10^{144}\right):\\ \;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\ \mathbf{else}:\\ \;\;\;\;\frac{x + \frac{\frac{1}{t \cdot z - x}}{\frac{1}{z \cdot y - x}}}{x + 1}\\ \end{array}\]

Reproduce

herbie shell --seed 2019212 +o rules:numerics
(FPCore (x y z t)
  :name "Diagrams.Trail:splitAtParam  from diagrams-lib-1.3.0.3, A"
  :precision binary64

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

  (/ (+ x (/ (- (* y z) x) (- (* t z) x))) (+ x 1)))