Average Error: 16.6 → 8.7
Time: 21.9s
Precision: binary64
\[\frac{x + \frac{y \cdot z}{t}}{\left(a + 1\right) + \frac{y \cdot b}{t}}\]
\[\begin{array}{l} \mathbf{if}\;t \leq -2.777704292510519 \cdot 10^{+40} \lor \neg \left(t \leq 3.476939493132477 \cdot 10^{-115}\right):\\ \;\;\;\;\frac{z}{t} \cdot \frac{y}{a + \left(\frac{y}{\frac{t}{b}} + 1\right)} + \frac{x}{a + \left(1 + \frac{y \cdot b}{t}\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{a + \left(1 + \frac{y \cdot b}{t}\right)} + \frac{z \cdot y}{t + \left(y \cdot b + t \cdot a\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 \leq -2.777704292510519 \cdot 10^{+40} \lor \neg \left(t \leq 3.476939493132477 \cdot 10^{-115}\right):\\
\;\;\;\;\frac{z}{t} \cdot \frac{y}{a + \left(\frac{y}{\frac{t}{b}} + 1\right)} + \frac{x}{a + \left(1 + \frac{y \cdot b}{t}\right)}\\

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

\end{array}
(FPCore (x y z t a b)
 :precision binary64
 (/ (+ x (/ (* y z) t)) (+ (+ a 1.0) (/ (* y b) t))))
(FPCore (x y z t a b)
 :precision binary64
 (if (or (<= t -2.777704292510519e+40) (not (<= t 3.476939493132477e-115)))
   (+
    (* (/ z t) (/ y (+ a (+ (/ y (/ t b)) 1.0))))
    (/ x (+ a (+ 1.0 (/ (* y b) t)))))
   (+
    (/ x (+ a (+ 1.0 (/ (* y b) t))))
    (/ (* z y) (+ t (+ (* y b) (* t a)))))))
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 tmp;
	if ((t <= -2.777704292510519e+40) || !(t <= 3.476939493132477e-115)) {
		tmp = ((z / t) * (y / (a + ((y / (t / b)) + 1.0)))) + (x / (a + (1.0 + ((y * b) / t))));
	} else {
		tmp = (x / (a + (1.0 + ((y * b) / t)))) + ((z * y) / (t + ((y * b) + (t * a))));
	}
	return tmp;
}

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.3
Herbie8.7
\[\begin{array}{l} \mathbf{if}\;t < -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 < 3.036967103737246 \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 < -2.7777042925105192e40 or 3.47693949313247707e-115 < t

    1. Initial program 12.2

      \[\frac{x + \frac{y \cdot z}{t}}{\left(a + 1\right) + \frac{y \cdot b}{t}}\]
    2. Taylor expanded around 0 13.2

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

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

      \[\leadsto \color{blue}{\frac{z}{t} \cdot \frac{y}{a + \left(\frac{y \cdot b}{t} + 1\right)}} + \frac{x}{a + \left(\frac{y \cdot b}{t} + 1\right)}\]
    6. Using strategy rm
    7. Applied associate-/l*_binary64_191196.6

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

    if -2.7777042925105192e40 < t < 3.47693949313247707e-115

    1. Initial program 22.4

      \[\frac{x + \frac{y \cdot z}{t}}{\left(a + 1\right) + \frac{y \cdot b}{t}}\]
    2. Taylor expanded around 0 18.0

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \leq -2.777704292510519 \cdot 10^{+40} \lor \neg \left(t \leq 3.476939493132477 \cdot 10^{-115}\right):\\ \;\;\;\;\frac{z}{t} \cdot \frac{y}{a + \left(\frac{y}{\frac{t}{b}} + 1\right)} + \frac{x}{a + \left(1 + \frac{y \cdot b}{t}\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{a + \left(1 + \frac{y \cdot b}{t}\right)} + \frac{z \cdot y}{t + \left(y \cdot b + t \cdot a\right)}\\ \end{array}\]

Reproduce

herbie shell --seed 2021027 
(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.0 (* (+ x (* (/ y t) z)) (/ 1.0 (+ (+ a 1.0) (* (/ y t) b))))) (if (< t 3.036967103737246e-130) (/ z b) (* 1.0 (* (+ x (* (/ y t) z)) (/ 1.0 (+ (+ a 1.0) (* (/ y t) b)))))))

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