Average Error: 16.6 → 6.7
Time: 9.8s
Precision: binary64
\[\frac{x + \frac{y \cdot z}{t}}{\left(a + 1\right) + \frac{y \cdot b}{t}}\]
\[\begin{array}{l} \mathbf{if}\;\frac{x + \frac{y \cdot z}{t}}{\left(a + 1\right) + \frac{y \cdot b}{t}} \leq -1.7627119181849528 \cdot 10^{-76}:\\ \;\;\;\;\frac{z}{\frac{t \cdot \left(a + \left(1 + \frac{y \cdot b}{t}\right)\right)}{y}} + \frac{x}{a + \left(1 + \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 2.6002272848639343 \cdot 10^{+225}:\\ \;\;\;\;\frac{x + \frac{y \cdot z}{t}}{\left(a + 1\right) + \frac{y}{\sqrt[3]{t} \cdot \sqrt[3]{t}} \cdot \frac{b}{\sqrt[3]{t}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{a + \left(1 + \frac{y \cdot b}{t}\right)} + \frac{z}{b}\\ \end{array}\]
\frac{x + \frac{y \cdot z}{t}}{\left(a + 1\right) + \frac{y \cdot b}{t}}
\begin{array}{l}
\mathbf{if}\;\frac{x + \frac{y \cdot z}{t}}{\left(a + 1\right) + \frac{y \cdot b}{t}} \leq -1.7627119181849528 \cdot 10^{-76}:\\
\;\;\;\;\frac{z}{\frac{t \cdot \left(a + \left(1 + \frac{y \cdot b}{t}\right)\right)}{y}} + \frac{x}{a + \left(1 + \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 2.6002272848639343 \cdot 10^{+225}:\\
\;\;\;\;\frac{x + \frac{y \cdot z}{t}}{\left(a + 1\right) + \frac{y}{\sqrt[3]{t} \cdot \sqrt[3]{t}} \cdot \frac{b}{\sqrt[3]{t}}}\\

\mathbf{else}:\\
\;\;\;\;\frac{x}{a + \left(1 + \frac{y \cdot b}{t}\right)} + \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
 (if (<=
      (/ (+ x (/ (* y z) t)) (+ (+ a 1.0) (/ (* y b) t)))
      -1.7627119181849528e-76)
   (+
    (/ z (/ (* t (+ a (+ 1.0 (/ (* y b) t)))) y))
    (/ x (+ a (+ 1.0 (/ (* y b) t)))))
   (if (<=
        (/ (+ x (/ (* y z) t)) (+ (+ a 1.0) (/ (* y b) t)))
        2.6002272848639343e+225)
     (/
      (+ x (/ (* y z) t))
      (+ (+ a 1.0) (* (/ y (* (cbrt t) (cbrt t))) (/ b (cbrt t)))))
     (+ (/ x (+ a (+ 1.0 (/ (* y b) 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 tmp;
	if (((x + ((y * z) / t)) / ((a + 1.0) + ((y * b) / t))) <= -1.7627119181849528e-76) {
		tmp = (z / ((t * (a + (1.0 + ((y * b) / t)))) / y)) + (x / (a + (1.0 + ((y * b) / t))));
	} else if (((x + ((y * z) / t)) / ((a + 1.0) + ((y * b) / t))) <= 2.6002272848639343e+225) {
		tmp = (x + ((y * z) / t)) / ((a + 1.0) + ((y / (cbrt(t) * cbrt(t))) * (b / cbrt(t))));
	} else {
		tmp = (x / (a + (1.0 + ((y * b) / t)))) + (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.6
Target12.9
Herbie6.7
\[\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))) < -1.76271191818495e-76

    1. Initial program 9.7

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

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

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

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

    if -1.76271191818495e-76 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a 1) (/.f64 (*.f64 y b) t))) < 2.6002272848639343e225

    1. Initial program 8.3

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

      \[\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}}}}\]
    4. Applied times-frac_binary647.1

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

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

    1. Initial program 56.4

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

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

      \[\leadsto \color{blue}{\frac{z \cdot y}{t \cdot \left(a + \left(\frac{y \cdot b}{t} + 1\right)\right)} + \frac{x}{a + \left(\frac{y \cdot b}{t} + 1\right)}}\]
    4. Taylor expanded around inf 13.0

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x + \frac{y \cdot z}{t}}{\left(a + 1\right) + \frac{y \cdot b}{t}} \leq -1.7627119181849528 \cdot 10^{-76}:\\ \;\;\;\;\frac{z}{\frac{t \cdot \left(a + \left(1 + \frac{y \cdot b}{t}\right)\right)}{y}} + \frac{x}{a + \left(1 + \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 2.6002272848639343 \cdot 10^{+225}:\\ \;\;\;\;\frac{x + \frac{y \cdot z}{t}}{\left(a + 1\right) + \frac{y}{\sqrt[3]{t} \cdot \sqrt[3]{t}} \cdot \frac{b}{\sqrt[3]{t}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{a + \left(1 + \frac{y \cdot b}{t}\right)} + \frac{z}{b}\\ \end{array}\]

Alternatives

Reproduce

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