Average Error: 2.7 → 0.8
Time: 10.2s
Precision: 64
\[\frac{x}{y - z \cdot t}\]
\[\begin{array}{l} \mathbf{if}\;z \cdot t = -\infty \lor \neg \left(z \cdot t \le 1.431996334563184095862037514702706981881 \cdot 10^{269}\right):\\ \;\;\;\;\frac{1}{\frac{y}{x} - \frac{t}{x} \cdot z}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{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 1.431996334563184095862037514702706981881 \cdot 10^{269}\right):\\
\;\;\;\;\frac{1}{\frac{y}{x} - \frac{t}{x} \cdot z}\\

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

\end{array}
double f(double x, double y, double z, double t) {
        double r795534 = x;
        double r795535 = y;
        double r795536 = z;
        double r795537 = t;
        double r795538 = r795536 * r795537;
        double r795539 = r795535 - r795538;
        double r795540 = r795534 / r795539;
        return r795540;
}

double f(double x, double y, double z, double t) {
        double r795541 = z;
        double r795542 = t;
        double r795543 = r795541 * r795542;
        double r795544 = -inf.0;
        bool r795545 = r795543 <= r795544;
        double r795546 = 1.431996334563184e+269;
        bool r795547 = r795543 <= r795546;
        double r795548 = !r795547;
        bool r795549 = r795545 || r795548;
        double r795550 = 1.0;
        double r795551 = y;
        double r795552 = x;
        double r795553 = r795551 / r795552;
        double r795554 = r795542 / r795552;
        double r795555 = r795554 * r795541;
        double r795556 = r795553 - r795555;
        double r795557 = r795550 / r795556;
        double r795558 = r795551 - r795543;
        double r795559 = r795552 / r795558;
        double r795560 = r795549 ? r795557 : r795559;
        return r795560;
}

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.7
Target1.7
Herbie0.8
\[\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 1.431996334563184e+269 < (* z t)

    1. Initial program 18.2

      \[\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. Using strategy rm
    5. Applied div-sub22.0

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

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

    if -inf.0 < (* z t) < 1.431996334563184e+269

    1. Initial program 0.1

      \[\frac{x}{y - z \cdot t}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification0.8

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

Reproduce

herbie shell --seed 2019351 +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))))