Average Error: 17.1 → 17.1
Time: 9.4s
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 -2.2422567553105098 \cdot 10^{-188} \lor \neg \left(t \le 3.7640263849659686 \cdot 10^{-78}\right):\\ \;\;\;\;\frac{1}{\frac{\left(a + 1\right) + y \cdot \frac{b}{t}}{x + \frac{y}{\frac{t}{z}}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x + \frac{y \cdot z}{t}}{\left(a \cdot a - 1 \cdot 1\right) \cdot t + \left(a - 1\right) \cdot \left(y \cdot b\right)} \cdot \left(\left(a - 1\right) \cdot 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 -2.2422567553105098 \cdot 10^{-188} \lor \neg \left(t \le 3.7640263849659686 \cdot 10^{-78}\right):\\
\;\;\;\;\frac{1}{\frac{\left(a + 1\right) + y \cdot \frac{b}{t}}{x + \frac{y}{\frac{t}{z}}}}\\

\mathbf{else}:\\
\;\;\;\;\frac{x + \frac{y \cdot z}{t}}{\left(a \cdot a - 1 \cdot 1\right) \cdot t + \left(a - 1\right) \cdot \left(y \cdot b\right)} \cdot \left(\left(a - 1\right) \cdot 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 <= -2.2422567553105098e-188) || !(t <= 3.7640263849659686e-78))) {
		VAR = ((double) (1.0 / ((double) (((double) (((double) (a + 1.0)) + ((double) (y * ((double) (b / t)))))) / ((double) (x + ((double) (y / ((double) (t / z))))))))));
	} else {
		VAR = ((double) (((double) (((double) (x + ((double) (((double) (y * z)) / t)))) / ((double) (((double) (((double) (((double) (a * a)) - ((double) (1.0 * 1.0)))) * t)) + ((double) (((double) (a - 1.0)) * ((double) (y * b)))))))) * ((double) (((double) (a - 1.0)) * t))));
	}
	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

Original17.1
Target13.2
Herbie17.1
\[\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 2 regimes
  2. if t < -2.2422567553105098e-188 or 3.7640263849659686e-78 < t

    1. Initial program 12.5

      \[\frac{x + \frac{y \cdot z}{t}}{\left(a + 1\right) + \frac{y \cdot b}{t}}\]
    2. Using strategy rm
    3. Applied associate-/l*11.1

      \[\leadsto \frac{x + \color{blue}{\frac{y}{\frac{t}{z}}}}{\left(a + 1\right) + \frac{y \cdot b}{t}}\]
    4. Using strategy rm
    5. Applied *-un-lft-identity11.1

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

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

      \[\leadsto \frac{x + \frac{y}{\frac{t}{z}}}{\left(a + 1\right) + \color{blue}{y} \cdot \frac{b}{t}}\]
    8. Using strategy rm
    9. Applied clear-num9.0

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

    if -2.2422567553105098e-188 < t < 3.7640263849659686e-78

    1. Initial program 28.8

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

      \[\leadsto \frac{x + \frac{y \cdot z}{t}}{\color{blue}{\frac{a \cdot a - 1 \cdot 1}{a - 1}} + \frac{y \cdot b}{t}}\]
    4. Applied frac-add35.7

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \le -2.2422567553105098 \cdot 10^{-188} \lor \neg \left(t \le 3.7640263849659686 \cdot 10^{-78}\right):\\ \;\;\;\;\frac{1}{\frac{\left(a + 1\right) + y \cdot \frac{b}{t}}{x + \frac{y}{\frac{t}{z}}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x + \frac{y \cdot z}{t}}{\left(a \cdot a - 1 \cdot 1\right) \cdot t + \left(a - 1\right) \cdot \left(y \cdot b\right)} \cdot \left(\left(a - 1\right) \cdot t\right)\\ \end{array}\]

Reproduce

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