Average Error: 16.1 → 6.6
Time: 8.5s
Precision: binary64
\[\frac{x + \frac{y \cdot z}{t}}{\left(a + 1\right) + \frac{y \cdot b}{t}} \]
\[\begin{array}{l} t_1 := x + \frac{y \cdot z}{t}\\ t_2 := \frac{y \cdot b}{t}\\ t_3 := \frac{t_1}{\left(a + 1\right) + t_2}\\ \mathbf{if}\;t_3 \leq -\infty:\\ \;\;\;\;\begin{array}{l} t_4 := 1 + \left(a + t_2\right)\\ \frac{y}{\frac{t \cdot t_4}{z}} + \frac{x}{t_4} \end{array}\\ \mathbf{elif}\;t_3 \leq 3.141174543174688 \cdot 10^{+292}:\\ \;\;\;\;\frac{t_1}{\left(a + 1\right) + \frac{b \cdot \frac{y}{\sqrt[3]{t} \cdot \sqrt[3]{t}}}{\sqrt[3]{t}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{z}{b}\\ \end{array} \]
\frac{x + \frac{y \cdot z}{t}}{\left(a + 1\right) + \frac{y \cdot b}{t}}
\begin{array}{l}
t_1 := x + \frac{y \cdot z}{t}\\
t_2 := \frac{y \cdot b}{t}\\
t_3 := \frac{t_1}{\left(a + 1\right) + t_2}\\
\mathbf{if}\;t_3 \leq -\infty:\\
\;\;\;\;\begin{array}{l}
t_4 := 1 + \left(a + t_2\right)\\
\frac{y}{\frac{t \cdot t_4}{z}} + \frac{x}{t_4}
\end{array}\\

\mathbf{elif}\;t_3 \leq 3.141174543174688 \cdot 10^{+292}:\\
\;\;\;\;\frac{t_1}{\left(a + 1\right) + \frac{b \cdot \frac{y}{\sqrt[3]{t} \cdot \sqrt[3]{t}}}{\sqrt[3]{t}}}\\

\mathbf{else}:\\
\;\;\;\;\frac{z}{b}\\


\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
 (let* ((t_1 (+ x (/ (* y z) t)))
        (t_2 (/ (* y b) t))
        (t_3 (/ t_1 (+ (+ a 1.0) t_2))))
   (if (<= t_3 (- INFINITY))
     (let* ((t_4 (+ 1.0 (+ a t_2)))) (+ (/ y (/ (* t t_4) z)) (/ x t_4)))
     (if (<= t_3 3.141174543174688e+292)
       (/ t_1 (+ (+ a 1.0) (/ (* b (/ y (* (cbrt t) (cbrt t)))) (cbrt t))))
       (/ z b)))))
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 t_1 = x + ((y * z) / t);
	double t_2 = (y * b) / t;
	double t_3 = t_1 / ((a + 1.0) + t_2);
	double tmp;
	if (t_3 <= -((double) INFINITY)) {
		double t_4_1 = 1.0 + (a + t_2);
		tmp = (y / ((t * t_4_1) / z)) + (x / t_4_1);
	} else if (t_3 <= 3.141174543174688e+292) {
		tmp = t_1 / ((a + 1.0) + ((b * (y / (cbrt(t) * cbrt(t)))) / cbrt(t)));
	} else {
		tmp = z / b;
	}
	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.1
Target12.9
Herbie6.6
\[\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 (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a 1) (/.f64 (*.f64 y b) t))) < -inf.0

    1. Initial program 64.0

      \[\frac{x + \frac{y \cdot z}{t}}{\left(a + 1\right) + \frac{y \cdot b}{t}} \]
    2. Applied div-inv_binary6464.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. Taylor expanded in x around 0 36.8

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

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

    if -inf.0 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a 1) (/.f64 (*.f64 y b) t))) < 3.14117454317468818e292

    1. Initial program 5.8

      \[\frac{x + \frac{y \cdot z}{t}}{\left(a + 1\right) + \frac{y \cdot b}{t}} \]
    2. Applied add-cube-cbrt_binary646.0

      \[\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}}}} \]
    3. Applied associate-/r*_binary646.0

      \[\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}}}} \]
    4. Simplified5.3

      \[\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}}} \]

    if 3.14117454317468818e292 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a 1) (/.f64 (*.f64 y b) t)))

    1. Initial program 62.6

      \[\frac{x + \frac{y \cdot z}{t}}{\left(a + 1\right) + \frac{y \cdot b}{t}} \]
    2. Taylor expanded in y around inf 13.4

      \[\leadsto \color{blue}{\frac{z}{b}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification6.6

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x + \frac{y \cdot z}{t}}{\left(a + 1\right) + \frac{y \cdot b}{t}} \leq -\infty:\\ \;\;\;\;\frac{y}{\frac{t \cdot \left(1 + \left(a + \frac{y \cdot b}{t}\right)\right)}{z}} + \frac{x}{1 + \left(a + \frac{y \cdot b}{t}\right)}\\ \mathbf{elif}\;\frac{x + \frac{y \cdot z}{t}}{\left(a + 1\right) + \frac{y \cdot b}{t}} \leq 3.141174543174688 \cdot 10^{+292}:\\ \;\;\;\;\frac{x + \frac{y \cdot z}{t}}{\left(a + 1\right) + \frac{b \cdot \frac{y}{\sqrt[3]{t} \cdot \sqrt[3]{t}}}{\sqrt[3]{t}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{z}{b}\\ \end{array} \]

Reproduce

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