Average Error: 16.7 → 14.5
Time: 5.8s
Precision: binary64
\[\frac{x + \frac{y \cdot z}{t}}{\left(a + 1\right) + \frac{y \cdot b}{t}}\]
\[\begin{array}{l} \mathbf{if}\;b \leq -3.18900929198071 \cdot 10^{-192} \lor \neg \left(b \leq 2.0277050089477033 \cdot 10^{-113}\right):\\ \;\;\;\;\frac{-\left(x + \frac{z}{\frac{t}{y}}\right)}{-1 - \left(a + \frac{b}{\frac{t}{y}}\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{x + \left(z \cdot y\right) \cdot \frac{1}{t}}{\left(a + 1\right) + \frac{b \cdot y}{t}}\\ \end{array}\]
\frac{x + \frac{y \cdot z}{t}}{\left(a + 1\right) + \frac{y \cdot b}{t}}
\begin{array}{l}
\mathbf{if}\;b \leq -3.18900929198071 \cdot 10^{-192} \lor \neg \left(b \leq 2.0277050089477033 \cdot 10^{-113}\right):\\
\;\;\;\;\frac{-\left(x + \frac{z}{\frac{t}{y}}\right)}{-1 - \left(a + \frac{b}{\frac{t}{y}}\right)}\\

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

\end{array}
(FPCore (x y z t a b)
 :precision binary64
 (/ (+ x (/ (* y z) t)) (+ (+ a 1.0) (/ (* y b) t))))
(FPCore (x y z t a b)
 :precision binary64
 (if (or (<= b -3.18900929198071e-192) (not (<= b 2.0277050089477033e-113)))
   (/ (- (+ x (/ z (/ t y)))) (- -1.0 (+ a (/ b (/ t y)))))
   (/ (+ x (* (* z y) (/ 1.0 t))) (+ (+ a 1.0) (/ (* b y) t)))))
double code(double x, double y, double z, double t, double a, double b) {
	return (x + ((y * z) / t)) / ((a + 1.0) + ((y * b) / t));
}
double code(double x, double y, double z, double t, double a, double b) {
	double tmp;
	if ((b <= -3.18900929198071e-192) || !(b <= 2.0277050089477033e-113)) {
		tmp = -(x + (z / (t / y))) / (-1.0 - (a + (b / (t / y))));
	} else {
		tmp = (x + ((z * y) * (1.0 / t))) / ((a + 1.0) + ((b * y) / t));
	}
	return tmp;
}

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.0
Herbie14.5
\[\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 2 regimes
  2. if b < -3.1890092919807099e-192 or 2.02770500894770335e-113 < b

    1. Initial program 19.2

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

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

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

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

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

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

    if -3.1890092919807099e-192 < b < 2.02770500894770335e-113

    1. Initial program 9.0

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq -3.18900929198071 \cdot 10^{-192} \lor \neg \left(b \leq 2.0277050089477033 \cdot 10^{-113}\right):\\ \;\;\;\;\frac{-\left(x + \frac{z}{\frac{t}{y}}\right)}{-1 - \left(a + \frac{b}{\frac{t}{y}}\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{x + \left(z \cdot y\right) \cdot \frac{1}{t}}{\left(a + 1\right) + \frac{b \cdot y}{t}}\\ \end{array}\]

Reproduce

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