Average Error: 16.9 → 14.4
Time: 10.4s
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 -5.2992216364879 \cdot 10^{-317}:\\ \;\;\;\;\frac{x + \frac{y}{\sqrt[3]{t} \cdot \sqrt[3]{t}} \cdot \frac{z}{\sqrt[3]{t}}}{\left(a + 1\right) + \frac{y \cdot b}{t}}\\ \mathbf{elif}\;\frac{x + \frac{y \cdot z}{t}}{\left(a + 1\right) + \frac{y \cdot b}{t}} \leq 0:\\ \;\;\;\;\frac{x + \frac{y \cdot z}{t}}{\left(a + 1\right) + \frac{y}{\frac{t}{b}}}\\ \mathbf{elif}\;\frac{x + \frac{y \cdot z}{t}}{\left(a + 1\right) + \frac{y \cdot b}{t}} \leq 6.729897768429863 \cdot 10^{+245}:\\ \;\;\;\;\frac{x + \left(y \cdot z\right) \cdot \frac{1}{t}}{\left(a + 1\right) + \frac{y \cdot b}{t}}\\ \mathbf{else}:\\ \;\;\;\;\left(x + y \cdot \frac{z}{t}\right) \cdot \frac{1}{\left(a + 1\right) + \frac{y \cdot b}{t}}\\ \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 -5.2992216364879 \cdot 10^{-317}:\\
\;\;\;\;\frac{x + \frac{y}{\sqrt[3]{t} \cdot \sqrt[3]{t}} \cdot \frac{z}{\sqrt[3]{t}}}{\left(a + 1\right) + \frac{y \cdot b}{t}}\\

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

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

\mathbf{else}:\\
\;\;\;\;\left(x + y \cdot \frac{z}{t}\right) \cdot \frac{1}{\left(a + 1\right) + \frac{y \cdot b}{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 (<=
      (/ (+ x (/ (* y z) t)) (+ (+ a 1.0) (/ (* y b) t)))
      -5.2992216364879e-317)
   (/
    (+ x (* (/ y (* (cbrt t) (cbrt t))) (/ z (cbrt t))))
    (+ (+ a 1.0) (/ (* y b) t)))
   (if (<= (/ (+ x (/ (* y z) t)) (+ (+ a 1.0) (/ (* y b) t))) 0.0)
     (/ (+ x (/ (* y z) t)) (+ (+ a 1.0) (/ y (/ t b))))
     (if (<=
          (/ (+ x (/ (* y z) t)) (+ (+ a 1.0) (/ (* y b) t)))
          6.729897768429863e+245)
       (/ (+ x (* (* y z) (/ 1.0 t))) (+ (+ a 1.0) (/ (* y b) t)))
       (* (+ x (* y (/ z t))) (/ 1.0 (+ (+ a 1.0) (/ (* y b) 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 (((x + ((y * z) / t)) / ((a + 1.0) + ((y * b) / t))) <= -5.2992216364879e-317) {
		tmp = (x + ((y / (cbrt(t) * cbrt(t))) * (z / cbrt(t)))) / ((a + 1.0) + ((y * b) / t));
	} else if (((x + ((y * z) / t)) / ((a + 1.0) + ((y * b) / t))) <= 0.0) {
		tmp = (x + ((y * z) / t)) / ((a + 1.0) + (y / (t / b)));
	} else if (((x + ((y * z) / t)) / ((a + 1.0) + ((y * b) / t))) <= 6.729897768429863e+245) {
		tmp = (x + ((y * z) * (1.0 / t))) / ((a + 1.0) + ((y * b) / t));
	} else {
		tmp = (x + (y * (z / t))) * (1.0 / ((a + 1.0) + ((y * b) / 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.9
Target13.9
Herbie14.4
\[\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 4 regimes
  2. if (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a 1) (/.f64 (*.f64 y b) t))) < -5.2992216e-317

    1. Initial program 7.6

      \[\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_binary64_195507.9

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

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

    if -5.2992216e-317 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a 1) (/.f64 (*.f64 y b) t))) < 0.0

    1. Initial program 29.6

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

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

    if 0.0 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a 1) (/.f64 (*.f64 y b) t))) < 6.72989776842986316e245

    1. Initial program 0.6

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

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

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

    1. Initial program 55.9

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

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

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

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

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

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

Reproduce

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