Average Error: 2.8 → 0.9
Time: 12.7s
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 r523407 = x;
        double r523408 = y;
        double r523409 = z;
        double r523410 = t;
        double r523411 = r523409 * r523410;
        double r523412 = r523408 - r523411;
        double r523413 = r523407 / r523412;
        return r523413;
}

double f(double x, double y, double z, double t) {
        double r523414 = z;
        double r523415 = t;
        double r523416 = r523414 * r523415;
        double r523417 = -inf.0;
        bool r523418 = r523416 <= r523417;
        double r523419 = 4.112367580534423e+257;
        bool r523420 = r523416 <= r523419;
        double r523421 = !r523420;
        bool r523422 = r523418 || r523421;
        double r523423 = 1.0;
        double r523424 = y;
        double r523425 = x;
        double r523426 = r523424 / r523425;
        double r523427 = r523425 / r523415;
        double r523428 = r523414 / r523427;
        double r523429 = r523426 - r523428;
        double r523430 = r523423 / r523429;
        double r523431 = r523424 - r523416;
        double r523432 = r523423 / r523431;
        double r523433 = r523425 * r523432;
        double r523434 = r523422 ? r523430 : r523433;
        return r523434;
}

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))))