Average Error: 16.6 → 12.6
Time: 5.2s
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.1635499459682052 \cdot 10^{-9} \lor \neg \left(t \le 2.4035747929488726 \cdot 10^{-35}\right):\\ \;\;\;\;\frac{x + y \cdot \frac{z}{t}}{1 \cdot \mathsf{fma}\left(\frac{y}{t}, b, a + 1\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{x + \frac{y \cdot z}{t}}{\left(a + 1\right) + \frac{\frac{y \cdot b}{\sqrt[3]{t} \cdot \sqrt[3]{t}}}{\sqrt[3]{t}}}\\ \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.1635499459682052 \cdot 10^{-9} \lor \neg \left(t \le 2.4035747929488726 \cdot 10^{-35}\right):\\
\;\;\;\;\frac{x + y \cdot \frac{z}{t}}{1 \cdot \mathsf{fma}\left(\frac{y}{t}, b, a + 1\right)}\\

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

\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.1635499459682052e-09) || !(t <= 2.4035747929488726e-35))) {
		temp = ((x + (y * (z / t))) / (1.0 * fma((y / t), b, (a + 1.0))));
	} else {
		temp = ((x + ((y * z) / t)) / ((a + 1.0) + (((y * b) / (cbrt(t) * cbrt(t))) / cbrt(t))));
	}
	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.0
Herbie12.6
\[\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.1635499459682052e-09 or 2.4035747929488726e-35 < t

    1. Initial program 11.8

      \[\frac{x + \frac{y \cdot z}{t}}{\left(a + 1\right) + \frac{y \cdot b}{t}}\]
    2. Using strategy rm
    3. Applied *-un-lft-identity11.8

      \[\leadsto \frac{x + \frac{y \cdot z}{t}}{\left(a + 1\right) + \color{blue}{1 \cdot \frac{y \cdot b}{t}}}\]
    4. Applied *-un-lft-identity11.8

      \[\leadsto \frac{x + \frac{y \cdot z}{t}}{\color{blue}{1 \cdot \left(a + 1\right)} + 1 \cdot \frac{y \cdot b}{t}}\]
    5. Applied distribute-lft-out11.8

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

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

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

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

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

    if -1.1635499459682052e-09 < t < 2.4035747929488726e-35

    1. Initial program 22.7

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

      \[\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 associate-/r*22.9

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \le -1.1635499459682052 \cdot 10^{-9} \lor \neg \left(t \le 2.4035747929488726 \cdot 10^{-35}\right):\\ \;\;\;\;\frac{x + y \cdot \frac{z}{t}}{1 \cdot \mathsf{fma}\left(\frac{y}{t}, b, a + 1\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{x + \frac{y \cdot z}{t}}{\left(a + 1\right) + \frac{\frac{y \cdot b}{\sqrt[3]{t} \cdot \sqrt[3]{t}}}{\sqrt[3]{t}}}\\ \end{array}\]

Reproduce

herbie shell --seed 2020056 +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))))