Average Error: 16.5 → 12.8
Time: 5.3s
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.65759808538895593 \cdot 10^{-44} \lor \neg \left(t \le 6.95030621352168587 \cdot 10^{-37}\right):\\ \;\;\;\;\frac{\mathsf{fma}\left(\frac{y}{t}, z, x\right)}{a + \mathsf{fma}\left(\frac{y}{t}, b, 1\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{x + \frac{1}{\frac{t}{y \cdot z}}}{\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}\;t \le -1.65759808538895593 \cdot 10^{-44} \lor \neg \left(t \le 6.95030621352168587 \cdot 10^{-37}\right):\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{y}{t}, z, x\right)}{a + \mathsf{fma}\left(\frac{y}{t}, b, 1\right)}\\

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

\end{array}
double code(double x, double y, double z, double t, double a, double b) {
	return ((double) (((double) (x + ((double) (((double) (y * z)) / t)))) / ((double) (((double) (a + 1.0)) + ((double) (((double) (y * b)) / t))))));
}
double code(double x, double y, double z, double t, double a, double b) {
	double VAR;
	if (((t <= -1.657598085388956e-44) || !(t <= 6.950306213521686e-37))) {
		VAR = ((double) (((double) fma(((double) (y / t)), z, x)) / ((double) (a + ((double) fma(((double) (y / t)), b, 1.0))))));
	} else {
		VAR = ((double) (((double) (x + ((double) (1.0 / ((double) (t / ((double) (y * z)))))))) / ((double) (((double) (a + 1.0)) + ((double) (((double) (y * b)) / t))))));
	}
	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.4
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 2 regimes
  2. if t < -1.657598085388956e-44 or 6.950306213521686e-37 < t

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

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

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

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

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

    if -1.657598085388956e-44 < t < 6.950306213521686e-37

    1. Initial program 23.0

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

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

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

Reproduce

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