Average Error: 2.8 → 0.9
Time: 13.1s
Precision: 64
\[\frac{x}{y - z \cdot t}\]
\[\begin{array}{l} \mathbf{if}\;z \cdot t = -\infty \lor \neg \left(z \cdot t \le 4.112367580534422791551820552983427548847 \cdot 10^{257}\right):\\ \;\;\;\;\frac{1}{\frac{y}{x} - \frac{z}{\frac{x}{t}}}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{1}{y - z \cdot t}\\ \end{array}\]
\frac{x}{y - z \cdot t}
\begin{array}{l}
\mathbf{if}\;z \cdot t = -\infty \lor \neg \left(z \cdot t \le 4.112367580534422791551820552983427548847 \cdot 10^{257}\right):\\
\;\;\;\;\frac{1}{\frac{y}{x} - \frac{z}{\frac{x}{t}}}\\

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

\end{array}
double f(double x, double y, double z, double t) {
        double r518789 = x;
        double r518790 = y;
        double r518791 = z;
        double r518792 = t;
        double r518793 = r518791 * r518792;
        double r518794 = r518790 - r518793;
        double r518795 = r518789 / r518794;
        return r518795;
}

double f(double x, double y, double z, double t) {
        double r518796 = z;
        double r518797 = t;
        double r518798 = r518796 * r518797;
        double r518799 = -inf.0;
        bool r518800 = r518798 <= r518799;
        double r518801 = 4.112367580534423e+257;
        bool r518802 = r518798 <= r518801;
        double r518803 = !r518802;
        bool r518804 = r518800 || r518803;
        double r518805 = 1.0;
        double r518806 = y;
        double r518807 = x;
        double r518808 = r518806 / r518807;
        double r518809 = r518807 / r518797;
        double r518810 = r518796 / r518809;
        double r518811 = r518808 - r518810;
        double r518812 = r518805 / r518811;
        double r518813 = r518806 - r518798;
        double r518814 = r518805 / r518813;
        double r518815 = r518807 * r518814;
        double r518816 = r518804 ? r518812 : r518815;
        return r518816;
}

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

Original2.8
Target1.6
Herbie0.9
\[\begin{array}{l} \mathbf{if}\;x \lt -1.618195973607048970493874632750554853795 \cdot 10^{50}:\\ \;\;\;\;\frac{1}{\frac{y}{x} - \frac{z}{x} \cdot t}\\ \mathbf{elif}\;x \lt 2.137830643487644440407921345820165445823 \cdot 10^{131}:\\ \;\;\;\;\frac{x}{y - z \cdot t}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\frac{y}{x} - \frac{z}{x} \cdot t}\\ \end{array}\]

Derivation

  1. Split input into 2 regimes
  2. if (* z t) < -inf.0 or 4.112367580534423e+257 < (* z t)

    1. Initial program 18.3

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

      \[\leadsto \color{blue}{\frac{1}{\frac{y - z \cdot t}{x}}}\]
    4. Simplified18.3

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

      \[\leadsto \frac{1}{\color{blue}{\frac{y}{x} - \frac{t \cdot z}{x}}}\]
    7. Simplified4.6

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

    if -inf.0 < (* z t) < 4.112367580534423e+257

    1. Initial program 0.1

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \cdot t = -\infty \lor \neg \left(z \cdot t \le 4.112367580534422791551820552983427548847 \cdot 10^{257}\right):\\ \;\;\;\;\frac{1}{\frac{y}{x} - \frac{z}{\frac{x}{t}}}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{1}{y - z \cdot t}\\ \end{array}\]

Reproduce

herbie shell --seed 2019323 
(FPCore (x y z t)
  :name "Diagrams.Solve.Tridiagonal:solveTriDiagonal from diagrams-solve-0.1, B"
  :precision binary64

  :herbie-target
  (if (< x -1.618195973607049e+50) (/ 1 (- (/ y x) (* (/ z x) t))) (if (< x 2.1378306434876444e+131) (/ x (- y (* z t))) (/ 1 (- (/ y x) (* (/ z x) t)))))

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