Average Error: 2.8 → 0.8
Time: 14.5s
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 r448942 = x;
        double r448943 = y;
        double r448944 = z;
        double r448945 = t;
        double r448946 = r448944 * r448945;
        double r448947 = r448943 - r448946;
        double r448948 = r448942 / r448947;
        return r448948;
}

double f(double x, double y, double z, double t) {
        double r448949 = z;
        double r448950 = t;
        double r448951 = r448949 * r448950;
        double r448952 = -inf.0;
        bool r448953 = r448951 <= r448952;
        double r448954 = 1.7336286183960998e+242;
        bool r448955 = r448951 <= r448954;
        double r448956 = !r448955;
        bool r448957 = r448953 || r448956;
        double r448958 = 1.0;
        double r448959 = y;
        double r448960 = x;
        double r448961 = r448959 / r448960;
        double r448962 = r448950 / r448960;
        double r448963 = r448962 * r448949;
        double r448964 = r448961 - r448963;
        double r448965 = r448958 / r448964;
        double r448966 = r448959 - r448951;
        double r448967 = r448960 / r448966;
        double r448968 = r448957 ? r448965 : r448967;
        return r448968;
}

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