Average Error: 16.7 → 12.9
Time: 6.0s
Precision: binary64
\[\frac{x + \frac{y \cdot z}{t}}{\left(a + 1\right) + \frac{y \cdot b}{t}}\]
\[\begin{array}{l} \mathbf{if}\;y \leq -2.5557366500054176 \cdot 10^{+50}:\\ \;\;\;\;\frac{1}{\frac{a + \left(1 + y \cdot \frac{b}{t}\right)}{x + y \cdot \frac{z}{t}}}\\ \mathbf{elif}\;y \leq 4.225386107957482 \cdot 10^{+45}:\\ \;\;\;\;\frac{x + \frac{y \cdot z}{t}}{\left(a + 1\right) + \frac{y \cdot b}{t}}\\ \mathbf{else}:\\ \;\;\;\;\left(x + y \cdot \frac{z}{t}\right) \cdot \frac{1}{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}\;y \leq -2.5557366500054176 \cdot 10^{+50}:\\
\;\;\;\;\frac{1}{\frac{a + \left(1 + y \cdot \frac{b}{t}\right)}{x + y \cdot \frac{z}{t}}}\\

\mathbf{elif}\;y \leq 4.225386107957482 \cdot 10^{+45}:\\
\;\;\;\;\frac{x + \frac{y \cdot z}{t}}{\left(a + 1\right) + \frac{y \cdot b}{t}}\\

\mathbf{else}:\\
\;\;\;\;\left(x + y \cdot \frac{z}{t}\right) \cdot \frac{1}{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) (x + (((double) (y * z)) / t))) / ((double) (((double) (a + 1.0)) + (((double) (y * b)) / t))));
}
double code(double x, double y, double z, double t, double a, double b) {
	double VAR;
	if ((y <= -2.5557366500054176e+50)) {
		VAR = (1.0 / (((double) (a + ((double) (1.0 + ((double) (y * (b / t))))))) / ((double) (x + ((double) (y * (z / t)))))));
	} else {
		double VAR_1;
		if ((y <= 4.225386107957482e+45)) {
			VAR_1 = (((double) (x + (((double) (y * z)) / t))) / ((double) (((double) (a + 1.0)) + (((double) (y * b)) / t))));
		} else {
			VAR_1 = ((double) (((double) (x + ((double) (y * (z / t))))) * (1.0 / ((double) (a + ((double) (1.0 + ((double) (y * (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.7
Target13.4
Herbie12.9
\[\begin{array}{l} \mathbf{if}\;t < -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 < 3.036967103737246 \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 y < -2.55573665000541761e50

    1. Initial program 33.7

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

      \[\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 clear-num23.7

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

    if -2.55573665000541761e50 < y < 4.2253861079574818e45

    1. Initial program 5.3

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

    if 4.2253861079574818e45 < y

    1. Initial program 33.2

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

      \[\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-inv24.2

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -2.5557366500054176 \cdot 10^{+50}:\\ \;\;\;\;\frac{1}{\frac{a + \left(1 + y \cdot \frac{b}{t}\right)}{x + y \cdot \frac{z}{t}}}\\ \mathbf{elif}\;y \leq 4.225386107957482 \cdot 10^{+45}:\\ \;\;\;\;\frac{x + \frac{y \cdot z}{t}}{\left(a + 1\right) + \frac{y \cdot b}{t}}\\ \mathbf{else}:\\ \;\;\;\;\left(x + y \cdot \frac{z}{t}\right) \cdot \frac{1}{a + \left(1 + y \cdot \frac{b}{t}\right)}\\ \end{array}\]

Reproduce

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