Average Error: 3.0 → 0.9
Time: 4.1s
Precision: binary64
\[\frac{x}{y - z \cdot t}\]
\[\begin{array}{l} \mathbf{if}\;z \cdot t = -inf.0 \lor \neg \left(z \cdot t \le 2.9899702994294331 \cdot 10^{214}\right):\\ \;\;\;\;\frac{1}{\frac{y}{x} - z \cdot \frac{t}{x}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y - z \cdot t}\\ \end{array}\]
\frac{x}{y - z \cdot t}
\begin{array}{l}
\mathbf{if}\;z \cdot t = -inf.0 \lor \neg \left(z \cdot t \le 2.9899702994294331 \cdot 10^{214}\right):\\
\;\;\;\;\frac{1}{\frac{y}{x} - z \cdot \frac{t}{x}}\\

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

\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 (((((double) (z * t)) <= -inf.0) || !(((double) (z * t)) <= 2.989970299429433e+214))) {
		VAR = ((double) (1.0 / ((double) (((double) (y / x)) - ((double) (z * ((double) (t / x))))))));
	} else {
		VAR = ((double) (x / ((double) (y - ((double) (z * t))))));
	}
	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

Original3.0
Target1.8
Herbie0.9
\[\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 2 regimes
  2. if (* z t) < -inf.0 or 2.9899702994294331e214 < (* z t)

    1. Initial program 15.8

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

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

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

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

    if -inf.0 < (* z t) < 2.9899702994294331e214

    1. Initial program 0.1

      \[\frac{x}{y - z \cdot t}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification0.9

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \cdot t = -inf.0 \lor \neg \left(z \cdot t \le 2.9899702994294331 \cdot 10^{214}\right):\\ \;\;\;\;\frac{1}{\frac{y}{x} - z \cdot \frac{t}{x}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y - z \cdot t}\\ \end{array}\]

Reproduce

herbie shell --seed 2020181 
(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))))