Average Error: 16.4 → 9.6
Time: 10.9s
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 -6.168003490853 \cdot 10^{-312}:\\ \;\;\;\;\frac{x + \frac{y \cdot \left(z \cdot \frac{1}{\sqrt[3]{t} \cdot \sqrt[3]{t}}\right)}{\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 \lor \neg \left(\frac{x + \frac{y \cdot z}{t}}{\left(a + 1\right) + \frac{y \cdot b}{t}} \leq \infty\right):\\ \;\;\;\;\frac{z}{b}\\ \mathbf{else}:\\ \;\;\;\;\frac{x + \frac{\frac{\sqrt[3]{y} \cdot \sqrt[3]{y}}{\sqrt[3]{t}} \cdot \left(z \cdot \frac{\sqrt[3]{y}}{\sqrt[3]{t}}\right)}{\sqrt[3]{t}}}{\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 -6.168003490853 \cdot 10^{-312}:\\
\;\;\;\;\frac{x + \frac{y \cdot \left(z \cdot \frac{1}{\sqrt[3]{t} \cdot \sqrt[3]{t}}\right)}{\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 \lor \neg \left(\frac{x + \frac{y \cdot z}{t}}{\left(a + 1\right) + \frac{y \cdot b}{t}} \leq \infty\right):\\
\;\;\;\;\frac{z}{b}\\

\mathbf{else}:\\
\;\;\;\;\frac{x + \frac{\frac{\sqrt[3]{y} \cdot \sqrt[3]{y}}{\sqrt[3]{t}} \cdot \left(z \cdot \frac{\sqrt[3]{y}}{\sqrt[3]{t}}\right)}{\sqrt[3]{t}}}{\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)))
      -6.168003490853e-312)
   (/
    (+ x (/ (* y (* z (/ 1.0 (* (cbrt t) (cbrt t))))) (cbrt t)))
    (+ (+ a 1.0) (/ (* y b) t)))
   (if (or (<= (/ (+ x (/ (* y z) t)) (+ (+ a 1.0) (/ (* y b) t))) 0.0)
           (not
            (<= (/ (+ x (/ (* y z) t)) (+ (+ a 1.0) (/ (* y b) t))) INFINITY)))
     (/ z b)
     (/
      (+
       x
       (/
        (* (/ (* (cbrt y) (cbrt y)) (cbrt t)) (* z (/ (cbrt y) (cbrt t))))
        (cbrt t)))
      (+ (+ 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))) <= -6.168003490853e-312) {
		tmp = (x + ((y * (z * (1.0 / (cbrt(t) * cbrt(t))))) / cbrt(t))) / ((a + 1.0) + ((y * b) / t));
	} else if ((((x + ((y * z) / t)) / ((a + 1.0) + ((y * b) / t))) <= 0.0) || !(((x + ((y * z) / t)) / ((a + 1.0) + ((y * b) / t))) <= ((double) INFINITY))) {
		tmp = z / b;
	} else {
		tmp = (x + ((((cbrt(y) * cbrt(y)) / cbrt(t)) * (z * (cbrt(y) / cbrt(t)))) / cbrt(t))) / ((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.4
Target13.8
Herbie9.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))) < -6.168003490853e-312

    1. Initial program 7.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_binary647.6

      \[\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 associate-/r*_binary647.6

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

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

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

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

    if -6.168003490853e-312 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a 1) (/.f64 (*.f64 y b) t))) < 0.0 or +inf.0 < (/.f64 (+.f64 x (/.f64 (*.f64 y z) t)) (+.f64 (+.f64 a 1) (/.f64 (*.f64 y b) t)))

    1. Initial program 42.3

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

      \[\leadsto \color{blue}{\frac{z}{b}}\]

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

    1. Initial program 7.1

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

      \[\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 associate-/r*_binary647.4

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

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

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

      \[\leadsto \frac{x + \frac{\color{blue}{\left(\frac{\sqrt[3]{y} \cdot \sqrt[3]{y}}{\sqrt[3]{t}} \cdot \frac{\sqrt[3]{y}}{\sqrt[3]{t}}\right)} \cdot z}{\sqrt[3]{t}}}{\left(a + 1\right) + \frac{y \cdot b}{t}}\]
    9. Applied associate-*l*_binary645.3

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

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

Reproduce

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