Average Error: 2.8 → 1.9
Time: 15.3s
Precision: 64
\[\frac{x}{y - z \cdot t}\]
\[\begin{array}{l} \mathbf{if}\;z \cdot t \le 1.349598904952956934646438794357870456303 \cdot 10^{289}:\\ \;\;\;\;\frac{x}{y - z \cdot t}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\frac{y}{x} - \frac{t}{x} \cdot z}\\ \end{array}\]
\frac{x}{y - z \cdot t}
\begin{array}{l}
\mathbf{if}\;z \cdot t \le 1.349598904952956934646438794357870456303 \cdot 10^{289}:\\
\;\;\;\;\frac{x}{y - z \cdot t}\\

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

\end{array}
double f(double x, double y, double z, double t) {
        double r451598 = x;
        double r451599 = y;
        double r451600 = z;
        double r451601 = t;
        double r451602 = r451600 * r451601;
        double r451603 = r451599 - r451602;
        double r451604 = r451598 / r451603;
        return r451604;
}

double f(double x, double y, double z, double t) {
        double r451605 = z;
        double r451606 = t;
        double r451607 = r451605 * r451606;
        double r451608 = 1.349598904952957e+289;
        bool r451609 = r451607 <= r451608;
        double r451610 = x;
        double r451611 = y;
        double r451612 = r451611 - r451607;
        double r451613 = r451610 / r451612;
        double r451614 = 1.0;
        double r451615 = r451611 / r451610;
        double r451616 = r451606 / r451610;
        double r451617 = r451616 * r451605;
        double r451618 = r451615 - r451617;
        double r451619 = r451614 / r451618;
        double r451620 = r451609 ? r451613 : r451619;
        return r451620;
}

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
Herbie1.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) < 1.349598904952957e+289

    1. Initial program 1.6

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

      \[\leadsto \color{blue}{\frac{1}{\frac{y - z \cdot t}{x}}}\]
    4. Using strategy rm
    5. Applied *-un-lft-identity2.1

      \[\leadsto \frac{1}{\frac{y - z \cdot t}{\color{blue}{1 \cdot x}}}\]
    6. Applied *-un-lft-identity2.1

      \[\leadsto \frac{1}{\frac{\color{blue}{1 \cdot \left(y - z \cdot t\right)}}{1 \cdot x}}\]
    7. Applied times-frac2.1

      \[\leadsto \frac{1}{\color{blue}{\frac{1}{1} \cdot \frac{y - z \cdot t}{x}}}\]
    8. Applied add-cube-cbrt2.1

      \[\leadsto \frac{\color{blue}{\left(\sqrt[3]{1} \cdot \sqrt[3]{1}\right) \cdot \sqrt[3]{1}}}{\frac{1}{1} \cdot \frac{y - z \cdot t}{x}}\]
    9. Applied times-frac2.1

      \[\leadsto \color{blue}{\frac{\sqrt[3]{1} \cdot \sqrt[3]{1}}{\frac{1}{1}} \cdot \frac{\sqrt[3]{1}}{\frac{y - z \cdot t}{x}}}\]
    10. Simplified2.1

      \[\leadsto \color{blue}{1} \cdot \frac{\sqrt[3]{1}}{\frac{y - z \cdot t}{x}}\]
    11. Simplified1.6

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

    if 1.349598904952957e+289 < (* z t)

    1. Initial program 17.9

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \cdot t \le 1.349598904952956934646438794357870456303 \cdot 10^{289}:\\ \;\;\;\;\frac{x}{y - z \cdot t}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\frac{y}{x} - \frac{t}{x} \cdot z}\\ \end{array}\]

Reproduce

herbie shell --seed 2019322 +o rules:numerics
(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))))