Average Error: 2.8 → 1.8
Time: 4.8s
Precision: binary64
\[\frac{x}{y - z \cdot t}\]
\[\begin{array}{l} \mathbf{if}\;x \le -1.71619342926808159 \cdot 10^{58}:\\ \;\;\;\;\frac{1}{\frac{y}{x} - z \cdot \frac{t}{x}}\\ \mathbf{elif}\;x \le 6.4471426827096399 \cdot 10^{-5}:\\ \;\;\;\;\frac{x}{y - z \cdot t}\\ \mathbf{elif}\;x \le 5.93600774227386195 \cdot 10^{137}:\\ \;\;\;\;\frac{1}{\frac{y}{x} - z \cdot \frac{t}{x}}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\frac{y - z \cdot t}{x}}\\ \end{array}\]
\frac{x}{y - z \cdot t}
\begin{array}{l}
\mathbf{if}\;x \le -1.71619342926808159 \cdot 10^{58}:\\
\;\;\;\;\frac{1}{\frac{y}{x} - z \cdot \frac{t}{x}}\\

\mathbf{elif}\;x \le 6.4471426827096399 \cdot 10^{-5}:\\
\;\;\;\;\frac{x}{y - z \cdot t}\\

\mathbf{elif}\;x \le 5.93600774227386195 \cdot 10^{137}:\\
\;\;\;\;\frac{1}{\frac{y}{x} - z \cdot \frac{t}{x}}\\

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

\end{array}
double code(double x, double y, double z, double t) {
	return ((double) (x / ((double) (y - ((double) (z * t))))));
}
double code(double x, double y, double z, double t) {
	double VAR;
	if ((x <= -1.7161934292680816e+58)) {
		VAR = ((double) (1.0 / ((double) (((double) (y / x)) - ((double) (z * ((double) (t / x))))))));
	} else {
		double VAR_1;
		if ((x <= 6.44714268270964e-05)) {
			VAR_1 = ((double) (x / ((double) (y - ((double) (z * t))))));
		} else {
			double VAR_2;
			if ((x <= 5.936007742273862e+137)) {
				VAR_2 = ((double) (1.0 / ((double) (((double) (y / x)) - ((double) (z * ((double) (t / x))))))));
			} else {
				VAR_2 = ((double) (1.0 / ((double) (((double) (y - ((double) (z * t)))) / x))));
			}
			VAR_1 = VAR_2;
		}
		VAR = VAR_1;
	}
	return VAR;
}

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.8
Herbie1.8
\[\begin{array}{l} \mathbf{if}\;x \lt -1.618195973607049 \cdot 10^{50}:\\ \;\;\;\;\frac{1}{\frac{y}{x} - \frac{z}{x} \cdot t}\\ \mathbf{elif}\;x \lt 2.13783064348764444 \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 3 regimes
  2. if x < -1.71619342926808159e58 or 6.4471426827096399e-5 < x < 5.93600774227386195e137

    1. Initial program 6.2

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

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

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

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

    if -1.71619342926808159e58 < x < 6.4471426827096399e-5

    1. Initial program 0.2

      \[\frac{x}{y - z \cdot t}\]

    if 5.93600774227386195e137 < x

    1. Initial program 6.9

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

      \[\leadsto \color{blue}{\frac{1}{\frac{y - z \cdot t}{x}}}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification1.8

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -1.71619342926808159 \cdot 10^{58}:\\ \;\;\;\;\frac{1}{\frac{y}{x} - z \cdot \frac{t}{x}}\\ \mathbf{elif}\;x \le 6.4471426827096399 \cdot 10^{-5}:\\ \;\;\;\;\frac{x}{y - z \cdot t}\\ \mathbf{elif}\;x \le 5.93600774227386195 \cdot 10^{137}:\\ \;\;\;\;\frac{1}{\frac{y}{x} - z \cdot \frac{t}{x}}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\frac{y - z \cdot t}{x}}\\ \end{array}\]

Reproduce

herbie shell --seed 2020179 
(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.0 (- (/ y x) (* (/ z x) t))) (if (< x 2.1378306434876444e+131) (/ x (- y (* z t))) (/ 1.0 (- (/ y x) (* (/ z x) t)))))

  (/ x (- y (* z t))))