Average Error: 16.5 → 14.0
Time: 5.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.54215107921783331 \cdot 10^{-37}:\\ \;\;\;\;\mathsf{fma}\left(\frac{y}{t}, z, x\right) \cdot \frac{1}{a + \mathsf{fma}\left(\frac{y}{t}, b, 1\right)}\\ \mathbf{elif}\;t \le 1.03638931227158246 \cdot 10^{242}:\\ \;\;\;\;\frac{x + \frac{y \cdot z}{t}}{\left(a + 1\right) + \frac{1}{\frac{t}{y \cdot b}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\frac{a + \mathsf{fma}\left(\frac{y}{t}, b, 1\right)}{\mathsf{fma}\left(\frac{y}{t}, z, x\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.54215107921783331 \cdot 10^{-37}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{t}, z, x\right) \cdot \frac{1}{a + \mathsf{fma}\left(\frac{y}{t}, b, 1\right)}\\

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

\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{a + \mathsf{fma}\left(\frac{y}{t}, b, 1\right)}{\mathsf{fma}\left(\frac{y}{t}, z, x\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.5421510792178333e-37)) {
		VAR = (fma((y / t), z, x) * (1.0 / (a + fma((y / t), b, 1.0))));
	} else {
		double VAR_1;
		if ((t <= 1.0363893122715825e+242)) {
			VAR_1 = ((x + ((y * z) / t)) / ((a + 1.0) + (1.0 / (t / (y * b)))));
		} else {
			VAR_1 = (1.0 / ((a + fma((y / t), b, 1.0)) / fma((y / t), z, x)));
		}
		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.5
Target13.5
Herbie14.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 3 regimes
  2. if t < -1.5421510792178333e-37

    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.8

      \[\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.8

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

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

      \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(\frac{y}{t}, z, x\right)}}{a + \mathsf{fma}\left(\frac{y}{t}, b, 1\right)}\]
    9. Using strategy rm
    10. Applied div-inv5.2

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

    if -1.5421510792178333e-37 < t < 1.0363893122715825e+242

    1. Initial program 18.9

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

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

    if 1.0363893122715825e+242 < t

    1. Initial program 14.1

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

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

      \[\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-identity9.1

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

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

      \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(\frac{y}{t}, z, x\right)}}{a + \mathsf{fma}\left(\frac{y}{t}, b, 1\right)}\]
    9. Using strategy rm
    10. Applied clear-num1.3

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \le -1.54215107921783331 \cdot 10^{-37}:\\ \;\;\;\;\mathsf{fma}\left(\frac{y}{t}, z, x\right) \cdot \frac{1}{a + \mathsf{fma}\left(\frac{y}{t}, b, 1\right)}\\ \mathbf{elif}\;t \le 1.03638931227158246 \cdot 10^{242}:\\ \;\;\;\;\frac{x + \frac{y \cdot z}{t}}{\left(a + 1\right) + \frac{1}{\frac{t}{y \cdot b}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\frac{a + \mathsf{fma}\left(\frac{y}{t}, b, 1\right)}{\mathsf{fma}\left(\frac{y}{t}, z, x\right)}}\\ \end{array}\]

Reproduce

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