Average Error: 16.6 → 13.0
Time: 6.0s
Precision: 64
\[\frac{x + \frac{y \cdot z}{t}}{\left(a + 1\right) + \frac{y \cdot b}{t}}\]
\[\begin{array}{l} \mathbf{if}\;t \le -1.07099712939921002 \cdot 10^{-15} \lor \neg \left(t \le 8.50855217814580292 \cdot 10^{98}\right):\\ \;\;\;\;\frac{x + y \cdot \frac{z}{t}}{\left(a + 1\right) + \frac{\frac{y}{\sqrt[3]{t} \cdot \sqrt[3]{t}}}{\frac{\sqrt[3]{t}}{b}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x + \frac{y \cdot z}{t}}{\left(a + 1\right) + \frac{1}{\frac{t}{y \cdot b}}}\\ \end{array}\]
\frac{x + \frac{y \cdot z}{t}}{\left(a + 1\right) + \frac{y \cdot b}{t}}
\begin{array}{l}
\mathbf{if}\;t \le -1.07099712939921002 \cdot 10^{-15} \lor \neg \left(t \le 8.50855217814580292 \cdot 10^{98}\right):\\
\;\;\;\;\frac{x + y \cdot \frac{z}{t}}{\left(a + 1\right) + \frac{\frac{y}{\sqrt[3]{t} \cdot \sqrt[3]{t}}}{\frac{\sqrt[3]{t}}{b}}}\\

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

\end{array}
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 temp;
	if (((t <= -1.07099712939921e-15) || !(t <= 8.508552178145803e+98))) {
		temp = ((x + (y * (z / t))) / ((a + 1.0) + ((y / (cbrt(t) * cbrt(t))) / (cbrt(t) / b))));
	} else {
		temp = ((x + ((y * z) / t)) / ((a + 1.0) + (1.0 / (t / (y * b)))));
	}
	return temp;
}

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.5
Herbie13.0
\[\begin{array}{l} \mathbf{if}\;t \lt -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 \lt 3.0369671037372459 \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 2 regimes
  2. if t < -1.07099712939921e-15 or 8.508552178145803e+98 < t

    1. Initial program 12.0

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

      \[\leadsto \frac{x + \frac{y \cdot z}{t}}{\left(a + 1\right) + \color{blue}{\frac{1}{\frac{t}{y \cdot b}}}}\]
    4. Using strategy rm
    5. Applied add-cube-cbrt12.1

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

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

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

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

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

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

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

    if -1.07099712939921e-15 < t < 8.508552178145803e+98

    1. Initial program 20.4

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \le -1.07099712939921002 \cdot 10^{-15} \lor \neg \left(t \le 8.50855217814580292 \cdot 10^{98}\right):\\ \;\;\;\;\frac{x + y \cdot \frac{z}{t}}{\left(a + 1\right) + \frac{\frac{y}{\sqrt[3]{t} \cdot \sqrt[3]{t}}}{\frac{\sqrt[3]{t}}{b}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x + \frac{y \cdot z}{t}}{\left(a + 1\right) + \frac{1}{\frac{t}{y \cdot b}}}\\ \end{array}\]

Reproduce

herbie shell --seed 2020049 +o rules:numerics
(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 (* (+ x (* (/ y t) z)) (/ 1 (+ (+ a 1) (* (/ y t) b))))) (if (< t 3.036967103737246e-130) (/ z b) (* 1 (* (+ x (* (/ y t) z)) (/ 1 (+ (+ a 1) (* (/ y t) b)))))))

  (/ (+ x (/ (* y z) t)) (+ (+ a 1) (/ (* y b) t))))