Average Error: 2.8 → 0.8
Time: 12.8s
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 r572870 = x;
        double r572871 = y;
        double r572872 = z;
        double r572873 = t;
        double r572874 = r572872 * r572873;
        double r572875 = r572871 - r572874;
        double r572876 = r572870 / r572875;
        return r572876;
}

double f(double x, double y, double z, double t) {
        double r572877 = z;
        double r572878 = t;
        double r572879 = r572877 * r572878;
        double r572880 = -inf.0;
        bool r572881 = r572879 <= r572880;
        double r572882 = 1.7336286183960998e+242;
        bool r572883 = r572879 <= r572882;
        double r572884 = !r572883;
        bool r572885 = r572881 || r572884;
        double r572886 = 1.0;
        double r572887 = y;
        double r572888 = x;
        double r572889 = r572887 / r572888;
        double r572890 = r572878 / r572888;
        double r572891 = r572890 * r572877;
        double r572892 = r572889 - r572891;
        double r572893 = r572886 / r572892;
        double r572894 = r572887 - r572879;
        double r572895 = r572888 / r572894;
        double r572896 = r572885 ? r572893 : r572895;
        return r572896;
}

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