Average Error: 16.7 → 13.1
Time: 6.9s
Precision: binary64
\[\frac{x + \frac{y \cdot z}{t}}{\left(a + 1\right) + \frac{y \cdot b}{t}}\]
\[\begin{array}{l} \mathbf{if}\;y \leq -20715212907.95677 \lor \neg \left(y \leq 5.1154286064408824 \cdot 10^{-71}\right):\\ \;\;\;\;\frac{x + y \cdot \frac{z}{t}}{\left(a + 1\right) + \frac{y}{\frac{t}{b}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x + \left(y \cdot z\right) \cdot \frac{1}{t}}{\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}\;y \leq -20715212907.95677 \lor \neg \left(y \leq 5.1154286064408824 \cdot 10^{-71}\right):\\
\;\;\;\;\frac{x + y \cdot \frac{z}{t}}{\left(a + 1\right) + \frac{y}{\frac{t}{b}}}\\

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

\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 (<= y -20715212907.95677) (not (<= y 5.1154286064408824e-71)))
   (/ (+ x (* y (/ z t))) (+ (+ a 1.0) (/ y (/ t b))))
   (/ (+ x (* (* y z) (/ 1.0 t))) (+ (+ a 1.0) (/ (* y b) t)))))
double code(double x, double y, double z, double t, double a, double b) {
	return (((double) (x + (((double) (y * z)) / t))) / ((double) (((double) (a + 1.0)) + (((double) (y * b)) / t))));
}
double code(double x, double y, double z, double t, double a, double b) {
	double tmp;
	if (((y <= -20715212907.95677) || !(y <= 5.1154286064408824e-71))) {
		tmp = (((double) (x + ((double) (y * (z / t))))) / ((double) (((double) (a + 1.0)) + (y / (t / b)))));
	} else {
		tmp = (((double) (x + ((double) (((double) (y * z)) * (1.0 / t))))) / ((double) (((double) (a + 1.0)) + (((double) (y * b)) / t))));
	}
	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.7
Target13.3
Herbie13.1
\[\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 y < -20715212907.956772 or 5.11542860644088242e-71 < y

    1. Initial program 27.6

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

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

      \[\leadsto \frac{x + \frac{y}{\frac{t}{z}}}{\left(a + 1\right) + \color{blue}{\frac{y}{\frac{t}{b}}}}\]
    6. Using strategy rm
    7. Applied div-inv_binary6420.9

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

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

    if -20715212907.956772 < y < 5.11542860644088242e-71

    1. Initial program 3.9

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

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

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

Reproduce

herbie shell --seed 2020210 
(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))))