Average Error: 15.9 → 14.3
Time: 14.7s
Precision: 64
\[\frac{x + \frac{y \cdot z}{t}}{\left(a + 1.0\right) + \frac{y \cdot b}{t}}\]
\[\frac{1}{\left(\frac{y}{t} \cdot b + a\right) + 1.0} \cdot \left(x + \frac{y}{t} \cdot z\right)\]
\frac{x + \frac{y \cdot z}{t}}{\left(a + 1.0\right) + \frac{y \cdot b}{t}}
\frac{1}{\left(\frac{y}{t} \cdot b + a\right) + 1.0} \cdot \left(x + \frac{y}{t} \cdot z\right)
double f(double x, double y, double z, double t, double a, double b) {
        double r39992901 = x;
        double r39992902 = y;
        double r39992903 = z;
        double r39992904 = r39992902 * r39992903;
        double r39992905 = t;
        double r39992906 = r39992904 / r39992905;
        double r39992907 = r39992901 + r39992906;
        double r39992908 = a;
        double r39992909 = 1.0;
        double r39992910 = r39992908 + r39992909;
        double r39992911 = b;
        double r39992912 = r39992902 * r39992911;
        double r39992913 = r39992912 / r39992905;
        double r39992914 = r39992910 + r39992913;
        double r39992915 = r39992907 / r39992914;
        return r39992915;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r39992916 = 1.0;
        double r39992917 = y;
        double r39992918 = t;
        double r39992919 = r39992917 / r39992918;
        double r39992920 = b;
        double r39992921 = r39992919 * r39992920;
        double r39992922 = a;
        double r39992923 = r39992921 + r39992922;
        double r39992924 = 1.0;
        double r39992925 = r39992923 + r39992924;
        double r39992926 = r39992916 / r39992925;
        double r39992927 = x;
        double r39992928 = z;
        double r39992929 = r39992919 * r39992928;
        double r39992930 = r39992927 + r39992929;
        double r39992931 = r39992926 * r39992930;
        return r39992931;
}

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

Original15.9
Target13.2
Herbie14.3
\[\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.0\right) + \frac{y}{t} \cdot b}\right)\\ \mathbf{elif}\;t \lt 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.0\right) + \frac{y}{t} \cdot b}\right)\\ \end{array}\]

Derivation

  1. Initial program 15.9

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

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

    \[\leadsto \color{blue}{\left(1 \cdot \left(x + \frac{y \cdot z}{t}\right)\right)} \cdot \frac{1}{\left(a + 1.0\right) + \frac{y \cdot b}{t}}\]
  6. Applied associate-*l*16.0

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

    \[\leadsto 1 \cdot \color{blue}{\frac{x + \frac{y}{\frac{t}{z}}}{1.0 + \left(a + \frac{y}{t} \cdot b\right)}}\]
  8. Using strategy rm
  9. Applied associate-/r/14.2

    \[\leadsto 1 \cdot \frac{x + \color{blue}{\frac{y}{t} \cdot z}}{1.0 + \left(a + \frac{y}{t} \cdot b\right)}\]
  10. Using strategy rm
  11. Applied div-inv14.3

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

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

Reproduce

herbie shell --seed 2019164 
(FPCore (x y z t a b)
  :name "Diagrams.Solve.Tridiagonal:solveCyclicTriDiagonal from diagrams-solve-0.1, B"

  :herbie-target
  (if (< t -1.3659085366310088e-271) (* 1 (* (+ x (* (/ y t) z)) (/ 1 (+ (+ a 1.0) (* (/ y t) b))))) (if (< t 3.036967103737246e-130) (/ z b) (* 1 (* (+ x (* (/ y t) z)) (/ 1 (+ (+ a 1.0) (* (/ y t) b)))))))

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