Average Error: 16.4 → 12.6
Time: 7.8s
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 -6.27473903219353011 \cdot 10^{67}:\\ \;\;\;\;\left(x + y \cdot \frac{z}{t}\right) \cdot \frac{1}{a + \left(1 + y \cdot \frac{b}{t}\right)}\\ \mathbf{elif}\;t \le 1.74649640126756118 \cdot 10^{41}:\\ \;\;\;\;\frac{x + \frac{y \cdot z}{t}}{\left(a + 1\right) + \frac{y \cdot b}{t}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x + y \cdot \frac{z}{t}}{a + \left(1 + \frac{y}{\sqrt{t}} \cdot \frac{b}{\sqrt{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 -6.27473903219353011 \cdot 10^{67}:\\
\;\;\;\;\left(x + y \cdot \frac{z}{t}\right) \cdot \frac{1}{a + \left(1 + y \cdot \frac{b}{t}\right)}\\

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

\mathbf{else}:\\
\;\;\;\;\frac{x + y \cdot \frac{z}{t}}{a + \left(1 + \frac{y}{\sqrt{t}} \cdot \frac{b}{\sqrt{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 <= -6.27473903219353e+67)) {
		VAR = ((double) (((double) (x + ((double) (y * ((double) (z / t)))))) * ((double) (1.0 / ((double) (a + ((double) (1.0 + ((double) (y * ((double) (b / t))))))))))));
	} else {
		double VAR_1;
		if ((t <= 1.746496401267561e+41)) {
			VAR_1 = ((double) (((double) (x + ((double) (((double) (y * z)) / t)))) / ((double) (((double) (a + 1.0)) + ((double) (((double) (y * b)) / t))))));
		} else {
			VAR_1 = ((double) (((double) (x + ((double) (y * ((double) (z / t)))))) / ((double) (a + ((double) (1.0 + ((double) (((double) (y / ((double) sqrt(t)))) * ((double) (b / ((double) sqrt(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.4
Target13.1
Herbie12.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 < -6.27473903219353011e67

    1. Initial program 12.2

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

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

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

    if -6.27473903219353011e67 < t < 1.74649640126756118e41

    1. Initial program 19.4

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

    if 1.74649640126756118e41 < t

    1. Initial program 12.5

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

      \[\leadsto \color{blue}{\frac{x + y \cdot \frac{z}{t}}{a + \left(1 + y \cdot \frac{b}{t}\right)}}\]
    3. Using strategy rm
    4. Applied add-sqr-sqrt3.7

      \[\leadsto \frac{x + y \cdot \frac{z}{t}}{a + \left(1 + y \cdot \frac{b}{\color{blue}{\sqrt{t} \cdot \sqrt{t}}}\right)}\]
    5. Applied *-un-lft-identity3.7

      \[\leadsto \frac{x + y \cdot \frac{z}{t}}{a + \left(1 + y \cdot \frac{\color{blue}{1 \cdot b}}{\sqrt{t} \cdot \sqrt{t}}\right)}\]
    6. Applied times-frac3.7

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \le -6.27473903219353011 \cdot 10^{67}:\\ \;\;\;\;\left(x + y \cdot \frac{z}{t}\right) \cdot \frac{1}{a + \left(1 + y \cdot \frac{b}{t}\right)}\\ \mathbf{elif}\;t \le 1.74649640126756118 \cdot 10^{41}:\\ \;\;\;\;\frac{x + \frac{y \cdot z}{t}}{\left(a + 1\right) + \frac{y \cdot b}{t}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x + y \cdot \frac{z}{t}}{a + \left(1 + \frac{y}{\sqrt{t}} \cdot \frac{b}{\sqrt{t}}\right)}\\ \end{array}\]

Reproduce

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