Average Error: 16.6 → 8.1
Time: 16.0s
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.4761138301972 \cdot 10^{-313}:\\ \;\;\;\;\frac{x + z \cdot \frac{y}{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{y \cdot z}{y \cdot b + t \cdot \left(a + 1\right)}\\ \mathbf{elif}\;\frac{x + \frac{y \cdot z}{t}}{\left(a + 1\right) + \frac{y \cdot b}{t}} \leq 4.834740908361885 \cdot 10^{+299}:\\ \;\;\;\;\frac{x + \frac{y \cdot z}{t}}{\left(a + 1\right) + \left(y \cdot b\right) \cdot \frac{1}{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}
\mathbf{if}\;\frac{x + \frac{y \cdot z}{t}}{\left(a + 1\right) + \frac{y \cdot b}{t}} \leq -1.4761138301972 \cdot 10^{-313}:\\
\;\;\;\;\frac{x + z \cdot \frac{y}{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{y \cdot z}{y \cdot b + t \cdot \left(a + 1\right)}\\

\mathbf{elif}\;\frac{x + \frac{y \cdot z}{t}}{\left(a + 1\right) + \frac{y \cdot b}{t}} \leq 4.834740908361885 \cdot 10^{+299}:\\
\;\;\;\;\frac{x + \frac{y \cdot z}{t}}{\left(a + 1\right) + \left(y \cdot b\right) \cdot \frac{1}{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
 (if (<=
      (/ (+ x (/ (* y z) t)) (+ (+ a 1.0) (/ (* y b) t)))
      -1.4761138301972e-313)
   (/ (+ x (* z (/ y t))) (+ (+ a 1.0) (/ (* y b) t)))
   (if (<= (/ (+ x (/ (* y z) t)) (+ (+ a 1.0) (/ (* y b) t))) 0.0)
     (/ (* y z) (+ (* y b) (* t (+ a 1.0))))
     (if (<=
          (/ (+ x (/ (* y z) t)) (+ (+ a 1.0) (/ (* y b) t)))
          4.834740908361885e+299)
       (/ (+ x (/ (* y z) t)) (+ (+ a 1.0) (* (* y b) (/ 1.0 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.4761138301972e-313) {
		tmp = (x + (z * (y / t))) / ((a + 1.0) + ((y * b) / t));
	} else if (((x + ((y * z) / t)) / ((a + 1.0) + ((y * b) / t))) <= 0.0) {
		tmp = (y * z) / ((y * b) + (t * (a + 1.0)));
	} else if (((x + ((y * z) / t)) / ((a + 1.0) + ((y * b) / t))) <= 4.834740908361885e+299) {
		tmp = (x + ((y * z) / t)) / ((a + 1.0) + ((y * b) * (1.0 / 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.6
Target13.1
Herbie8.1
\[\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))) < -1.4761138302e-313

    1. Initial program 8.4

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

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

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

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

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

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

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

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

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

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

    1. Initial program 27.2

      \[\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_2053527.2

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

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

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

    if -0.0 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a 1) (/.f64 (*.f64 y b) t))) < 4.83474090836188466e299

    1. Initial program 0.4

      \[\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_205350.4

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

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

    1. Initial program 63.3

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x + \frac{y \cdot z}{t}}{\left(a + 1\right) + \frac{y \cdot b}{t}} \leq -1.4761138301972 \cdot 10^{-313}:\\ \;\;\;\;\frac{x + z \cdot \frac{y}{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{y \cdot z}{y \cdot b + t \cdot \left(a + 1\right)}\\ \mathbf{elif}\;\frac{x + \frac{y \cdot z}{t}}{\left(a + 1\right) + \frac{y \cdot b}{t}} \leq 4.834740908361885 \cdot 10^{+299}:\\ \;\;\;\;\frac{x + \frac{y \cdot z}{t}}{\left(a + 1\right) + \left(y \cdot b\right) \cdot \frac{1}{t}}\\ \mathbf{else}:\\ \;\;\;\;\frac{z}{b}\\ \end{array}\]

Reproduce

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