Average Error: 16.7 → 12.8
Time: 3.9s
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.4106828041523268 \cdot 10^{51}:\\ \;\;\;\;\frac{x + y \cdot \frac{z}{t}}{a + \mathsf{fma}\left(\frac{y}{t}, b, 1\right)}\\ \mathbf{elif}\;t \le 7.22267405639126453 \cdot 10^{27}:\\ \;\;\;\;\frac{x + \frac{y \cdot z}{t}}{\left(a + 1\right) + \left(y \cdot b\right) \cdot \frac{1}{t}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x + \frac{y}{\sqrt[3]{t} \cdot \sqrt[3]{t}} \cdot \frac{z}{\sqrt[3]{t}}}{a + \mathsf{fma}\left(\frac{y}{t}, b, 1\right)}\\ \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.4106828041523268 \cdot 10^{51}:\\
\;\;\;\;\frac{x + y \cdot \frac{z}{t}}{a + \mathsf{fma}\left(\frac{y}{t}, b, 1\right)}\\

\mathbf{elif}\;t \le 7.22267405639126453 \cdot 10^{27}:\\
\;\;\;\;\frac{x + \frac{y \cdot z}{t}}{\left(a + 1\right) + \left(y \cdot b\right) \cdot \frac{1}{t}}\\

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

\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 VAR;
	if ((t <= -1.4106828041523268e+51)) {
		VAR = ((x + (y * (z / t))) / (a + fma((y / t), b, 1.0)));
	} else {
		double VAR_1;
		if ((t <= 7.222674056391265e+27)) {
			VAR_1 = ((x + ((y * z) / t)) / ((a + 1.0) + ((y * b) * (1.0 / t))));
		} else {
			VAR_1 = ((x + ((y / (cbrt(t) * cbrt(t))) * (z / cbrt(t)))) / (a + fma((y / t), b, 1.0)));
		}
		VAR = VAR_1;
	}
	return VAR;
}

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.7
Target13.3
Herbie12.8
\[\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 3 regimes
  2. if t < -1.4106828041523268e+51

    1. Initial program 11.5

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

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

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

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

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

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

    if -1.4106828041523268e+51 < t < 7.222674056391265e+27

    1. Initial program 20.8

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

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

    if 7.222674056391265e+27 < 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 associate-+l+12.0

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \le -1.4106828041523268 \cdot 10^{51}:\\ \;\;\;\;\frac{x + y \cdot \frac{z}{t}}{a + \mathsf{fma}\left(\frac{y}{t}, b, 1\right)}\\ \mathbf{elif}\;t \le 7.22267405639126453 \cdot 10^{27}:\\ \;\;\;\;\frac{x + \frac{y \cdot z}{t}}{\left(a + 1\right) + \left(y \cdot b\right) \cdot \frac{1}{t}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x + \frac{y}{\sqrt[3]{t} \cdot \sqrt[3]{t}} \cdot \frac{z}{\sqrt[3]{t}}}{a + \mathsf{fma}\left(\frac{y}{t}, b, 1\right)}\\ \end{array}\]

Reproduce

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