Average Error: 2.8 → 0.8
Time: 15.6s
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.733628618396099782371863316761312325019 \cdot 10^{242}\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.733628618396099782371863316761312325019 \cdot 10^{242}\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 r476978 = x;
        double r476979 = y;
        double r476980 = z;
        double r476981 = t;
        double r476982 = r476980 * r476981;
        double r476983 = r476979 - r476982;
        double r476984 = r476978 / r476983;
        return r476984;
}

double f(double x, double y, double z, double t) {
        double r476985 = z;
        double r476986 = t;
        double r476987 = r476985 * r476986;
        double r476988 = -inf.0;
        bool r476989 = r476987 <= r476988;
        double r476990 = 1.7336286183960998e+242;
        bool r476991 = r476987 <= r476990;
        double r476992 = !r476991;
        bool r476993 = r476989 || r476992;
        double r476994 = 1.0;
        double r476995 = y;
        double r476996 = x;
        double r476997 = r476995 / r476996;
        double r476998 = r476986 / r476996;
        double r476999 = r476998 * r476985;
        double r477000 = r476997 - r476999;
        double r477001 = r476994 / r477000;
        double r477002 = r476995 - r476987;
        double r477003 = r476996 / r477002;
        double r477004 = r476993 ? r477001 : r477003;
        return r477004;
}

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.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.7336286183960998e+242 < (* z t)

    1. Initial program 17.4

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

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

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

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

    if -inf.0 < (* z t) < 1.7336286183960998e+242

    1. Initial program 0.1

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

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

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

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

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

      \[\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-frac0.7

      \[\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. Simplified0.7

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

      \[\leadsto 1 \cdot \color{blue}{\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.733628618396099782371863316761312325019 \cdot 10^{242}\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 2019323 +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))))