Average Error: 16.6 → 13.6
Time: 12.1s
Precision: binary64
\[\frac{x + \frac{y \cdot z}{t}}{\left(a + 1\right) + \frac{y \cdot b}{t}}\]
\[\begin{array}{l} \mathbf{if}\;t \le -9.1733867505784784 \cdot 10^{-299}:\\ \;\;\;\;\frac{x + \frac{y}{t} \cdot z}{a + \left(1 + \frac{y}{t} \cdot b\right)}\\ \mathbf{elif}\;t \le 1.8495783259794747 \cdot 10^{-30}:\\ \;\;\;\;\frac{x + \frac{y \cdot z}{t}}{\left(a + 1\right) + \left(y \cdot b\right) \cdot \frac{1}{t}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x + y \cdot \frac{z}{t}}{a + \left(1 + y \cdot \frac{b}{t}\right)}\\ \end{array}\]
\frac{x + \frac{y \cdot z}{t}}{\left(a + 1\right) + \frac{y \cdot b}{t}}
\begin{array}{l}
\mathbf{if}\;t \le -9.1733867505784784 \cdot 10^{-299}:\\
\;\;\;\;\frac{x + \frac{y}{t} \cdot z}{a + \left(1 + \frac{y}{t} \cdot b\right)}\\

\mathbf{elif}\;t \le 1.8495783259794747 \cdot 10^{-30}:\\
\;\;\;\;\frac{x + \frac{y \cdot z}{t}}{\left(a + 1\right) + \left(y \cdot b\right) \cdot \frac{1}{t}}\\

\mathbf{else}:\\
\;\;\;\;\frac{x + y \cdot \frac{z}{t}}{a + \left(1 + y \cdot \frac{b}{t}\right)}\\

\end{array}
double code(double x, double y, double z, double t, double a, double b) {
	return ((double) (((double) (x + ((double) (((double) (y * z)) / t)))) / ((double) (((double) (a + 1.0)) + ((double) (((double) (y * b)) / t))))));
}
double code(double x, double y, double z, double t, double a, double b) {
	double VAR;
	if ((t <= -9.173386750578478e-299)) {
		VAR = ((double) (((double) (x + ((double) (((double) (y / t)) * z)))) / ((double) (a + ((double) (1.0 + ((double) (((double) (y / t)) * b))))))));
	} else {
		double VAR_1;
		if ((t <= 1.8495783259794747e-30)) {
			VAR_1 = ((double) (((double) (x + ((double) (((double) (y * z)) / t)))) / ((double) (((double) (a + 1.0)) + ((double) (((double) (y * b)) * ((double) (1.0 / t))))))));
		} else {
			VAR_1 = ((double) (((double) (x + ((double) (y * ((double) (z / t)))))) / ((double) (a + ((double) (1.0 + ((double) (y * ((double) (b / t))))))))));
		}
		VAR = VAR_1;
	}
	return VAR;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Bits error versus a

Bits error versus b

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original16.6
Target13.4
Herbie13.6
\[\begin{array}{l} \mathbf{if}\;t \lt -1.3659085366310088 \cdot 10^{-271}:\\ \;\;\;\;1 \cdot \left(\left(x + \frac{y}{t} \cdot z\right) \cdot \frac{1}{\left(a + 1\right) + \frac{y}{t} \cdot b}\right)\\ \mathbf{elif}\;t \lt 3.0369671037372459 \cdot 10^{-130}:\\ \;\;\;\;\frac{z}{b}\\ \mathbf{else}:\\ \;\;\;\;1 \cdot \left(\left(x + \frac{y}{t} \cdot z\right) \cdot \frac{1}{\left(a + 1\right) + \frac{y}{t} \cdot b}\right)\\ \end{array}\]

Derivation

  1. Split input into 3 regimes
  2. if t < -9.1733867505784784e-299

    1. Initial program 16.5

      \[\frac{x + \frac{y \cdot z}{t}}{\left(a + 1\right) + \frac{y \cdot b}{t}}\]
    2. Using strategy rm
    3. Applied add-cube-cbrt16.6

      \[\leadsto \frac{x + \frac{y \cdot z}{t}}{\left(a + 1\right) + \frac{y \cdot b}{\color{blue}{\left(\sqrt[3]{t} \cdot \sqrt[3]{t}\right) \cdot \sqrt[3]{t}}}}\]
    4. Applied associate-/r*16.6

      \[\leadsto \frac{x + \frac{y \cdot z}{t}}{\left(a + 1\right) + \color{blue}{\frac{\frac{y \cdot b}{\sqrt[3]{t} \cdot \sqrt[3]{t}}}{\sqrt[3]{t}}}}\]
    5. Simplified15.9

      \[\leadsto \frac{x + \frac{y \cdot z}{t}}{\left(a + 1\right) + \frac{\color{blue}{\frac{y}{\sqrt[3]{t} \cdot \sqrt[3]{t}} \cdot b}}{\sqrt[3]{t}}}\]
    6. Using strategy rm
    7. Applied div-inv15.9

      \[\leadsto \color{blue}{\left(x + \frac{y \cdot z}{t}\right) \cdot \frac{1}{\left(a + 1\right) + \frac{\frac{y}{\sqrt[3]{t} \cdot \sqrt[3]{t}} \cdot b}{\sqrt[3]{t}}}}\]
    8. Simplified15.9

      \[\leadsto \left(x + \frac{y \cdot z}{t}\right) \cdot \color{blue}{\frac{1}{a + \left(1 + \frac{y}{t} \cdot b\right)}}\]
    9. Using strategy rm
    10. Applied associate-*r/15.8

      \[\leadsto \color{blue}{\frac{\left(x + \frac{y \cdot z}{t}\right) \cdot 1}{a + \left(1 + \frac{y}{t} \cdot b\right)}}\]
    11. Simplified14.2

      \[\leadsto \frac{\color{blue}{x + \frac{y}{t} \cdot z}}{a + \left(1 + \frac{y}{t} \cdot b\right)}\]

    if -9.1733867505784784e-299 < t < 1.8495783259794747e-30

    1. Initial program 23.3

      \[\frac{x + \frac{y \cdot z}{t}}{\left(a + 1\right) + \frac{y \cdot b}{t}}\]
    2. Using strategy rm
    3. Applied div-inv23.4

      \[\leadsto \frac{x + \frac{y \cdot z}{t}}{\left(a + 1\right) + \color{blue}{\left(y \cdot b\right) \cdot \frac{1}{t}}}\]

    if 1.8495783259794747e-30 < t

    1. Initial program 11.6

      \[\frac{x + \frac{y \cdot z}{t}}{\left(a + 1\right) + \frac{y \cdot b}{t}}\]
    2. Simplified4.8

      \[\leadsto \color{blue}{\frac{x + y \cdot \frac{z}{t}}{a + \left(1 + y \cdot \frac{b}{t}\right)}}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification13.6

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \le -9.1733867505784784 \cdot 10^{-299}:\\ \;\;\;\;\frac{x + \frac{y}{t} \cdot z}{a + \left(1 + \frac{y}{t} \cdot b\right)}\\ \mathbf{elif}\;t \le 1.8495783259794747 \cdot 10^{-30}:\\ \;\;\;\;\frac{x + \frac{y \cdot z}{t}}{\left(a + 1\right) + \left(y \cdot b\right) \cdot \frac{1}{t}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x + y \cdot \frac{z}{t}}{a + \left(1 + y \cdot \frac{b}{t}\right)}\\ \end{array}\]

Reproduce

herbie shell --seed 2020179 
(FPCore (x y z t a b)
  :name "Diagrams.Solve.Tridiagonal:solveCyclicTriDiagonal from diagrams-solve-0.1, B"
  :precision binary64

  :herbie-target
  (if (< t -1.3659085366310088e-271) (* 1.0 (* (+ x (* (/ y t) z)) (/ 1.0 (+ (+ a 1.0) (* (/ y t) b))))) (if (< t 3.036967103737246e-130) (/ z b) (* 1.0 (* (+ x (* (/ y t) z)) (/ 1.0 (+ (+ a 1.0) (* (/ y t) b)))))))

  (/ (+ x (/ (* y z) t)) (+ (+ a 1.0) (/ (* y b) t))))