Average Error: 16.8 → 13.5
Time: 16.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 -130880735029964599098845594471460004429800:\\ \;\;\;\;\frac{\frac{\sqrt[3]{\mathsf{fma}\left(\frac{y}{t}, z, x\right)}}{\sqrt[3]{\mathsf{fma}\left(\frac{y}{t}, b, a\right) + 1}}}{\frac{\sqrt[3]{\mathsf{fma}\left(\frac{y}{t}, b, a\right) + 1}}{\sqrt[3]{\mathsf{fma}\left(\frac{y}{t}, z, x\right)}}} \cdot \frac{\sqrt[3]{\mathsf{fma}\left(\frac{y}{t}, z, x\right)}}{\sqrt[3]{\mathsf{fma}\left(\frac{y}{t}, b, a\right) + 1}}\\ \mathbf{elif}\;t \le 3.253788647063419783059907819686125301725 \cdot 10^{83}:\\ \;\;\;\;\frac{x + \frac{y \cdot z}{t}}{\left(a + 1\right) + \frac{y \cdot b}{t}}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\frac{\mathsf{fma}\left(\frac{y}{t}, b, a\right) + 1}{\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 -130880735029964599098845594471460004429800:\\
\;\;\;\;\frac{\frac{\sqrt[3]{\mathsf{fma}\left(\frac{y}{t}, z, x\right)}}{\sqrt[3]{\mathsf{fma}\left(\frac{y}{t}, b, a\right) + 1}}}{\frac{\sqrt[3]{\mathsf{fma}\left(\frac{y}{t}, b, a\right) + 1}}{\sqrt[3]{\mathsf{fma}\left(\frac{y}{t}, z, x\right)}}} \cdot \frac{\sqrt[3]{\mathsf{fma}\left(\frac{y}{t}, z, x\right)}}{\sqrt[3]{\mathsf{fma}\left(\frac{y}{t}, b, a\right) + 1}}\\

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

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

\end{array}
double f(double x, double y, double z, double t, double a, double b) {
        double r470008 = x;
        double r470009 = y;
        double r470010 = z;
        double r470011 = r470009 * r470010;
        double r470012 = t;
        double r470013 = r470011 / r470012;
        double r470014 = r470008 + r470013;
        double r470015 = a;
        double r470016 = 1.0;
        double r470017 = r470015 + r470016;
        double r470018 = b;
        double r470019 = r470009 * r470018;
        double r470020 = r470019 / r470012;
        double r470021 = r470017 + r470020;
        double r470022 = r470014 / r470021;
        return r470022;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r470023 = t;
        double r470024 = -1.308807350299646e+41;
        bool r470025 = r470023 <= r470024;
        double r470026 = y;
        double r470027 = r470026 / r470023;
        double r470028 = z;
        double r470029 = x;
        double r470030 = fma(r470027, r470028, r470029);
        double r470031 = cbrt(r470030);
        double r470032 = b;
        double r470033 = a;
        double r470034 = fma(r470027, r470032, r470033);
        double r470035 = 1.0;
        double r470036 = r470034 + r470035;
        double r470037 = cbrt(r470036);
        double r470038 = r470031 / r470037;
        double r470039 = r470037 / r470031;
        double r470040 = r470038 / r470039;
        double r470041 = r470040 * r470038;
        double r470042 = 3.25378864706342e+83;
        bool r470043 = r470023 <= r470042;
        double r470044 = r470026 * r470028;
        double r470045 = r470044 / r470023;
        double r470046 = r470029 + r470045;
        double r470047 = r470033 + r470035;
        double r470048 = r470026 * r470032;
        double r470049 = r470048 / r470023;
        double r470050 = r470047 + r470049;
        double r470051 = r470046 / r470050;
        double r470052 = 1.0;
        double r470053 = r470036 / r470030;
        double r470054 = r470052 / r470053;
        double r470055 = r470043 ? r470051 : r470054;
        double r470056 = r470025 ? r470041 : r470055;
        return r470056;
}

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

Target

Original16.8
Target13.5
Herbie13.5
\[\begin{array}{l} \mathbf{if}\;t \lt -1.365908536631008841640163147697088508132 \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.036967103737245906066829435890093573122 \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.308807350299646e+41

    1. Initial program 11.6

      \[\frac{x + \frac{y \cdot z}{t}}{\left(a + 1\right) + \frac{y \cdot b}{t}}\]
    2. Simplified3.2

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

      \[\leadsto \color{blue}{\frac{1}{\frac{\mathsf{fma}\left(\frac{y}{t}, b, a\right) + 1}{\mathsf{fma}\left(\frac{y}{t}, z, x\right)}}}\]
    5. Using strategy rm
    6. Applied add-cube-cbrt4.6

      \[\leadsto \frac{1}{\frac{\mathsf{fma}\left(\frac{y}{t}, b, a\right) + 1}{\color{blue}{\left(\sqrt[3]{\mathsf{fma}\left(\frac{y}{t}, z, x\right)} \cdot \sqrt[3]{\mathsf{fma}\left(\frac{y}{t}, z, x\right)}\right) \cdot \sqrt[3]{\mathsf{fma}\left(\frac{y}{t}, z, x\right)}}}}\]
    7. Applied add-cube-cbrt4.8

      \[\leadsto \frac{1}{\frac{\color{blue}{\left(\sqrt[3]{\mathsf{fma}\left(\frac{y}{t}, b, a\right) + 1} \cdot \sqrt[3]{\mathsf{fma}\left(\frac{y}{t}, b, a\right) + 1}\right) \cdot \sqrt[3]{\mathsf{fma}\left(\frac{y}{t}, b, a\right) + 1}}}{\left(\sqrt[3]{\mathsf{fma}\left(\frac{y}{t}, z, x\right)} \cdot \sqrt[3]{\mathsf{fma}\left(\frac{y}{t}, z, x\right)}\right) \cdot \sqrt[3]{\mathsf{fma}\left(\frac{y}{t}, z, x\right)}}}\]
    8. Applied times-frac4.7

      \[\leadsto \frac{1}{\color{blue}{\frac{\sqrt[3]{\mathsf{fma}\left(\frac{y}{t}, b, a\right) + 1} \cdot \sqrt[3]{\mathsf{fma}\left(\frac{y}{t}, b, a\right) + 1}}{\sqrt[3]{\mathsf{fma}\left(\frac{y}{t}, z, x\right)} \cdot \sqrt[3]{\mathsf{fma}\left(\frac{y}{t}, z, x\right)}} \cdot \frac{\sqrt[3]{\mathsf{fma}\left(\frac{y}{t}, b, a\right) + 1}}{\sqrt[3]{\mathsf{fma}\left(\frac{y}{t}, z, x\right)}}}}\]
    9. Applied add-cube-cbrt4.7

      \[\leadsto \frac{\color{blue}{\left(\sqrt[3]{1} \cdot \sqrt[3]{1}\right) \cdot \sqrt[3]{1}}}{\frac{\sqrt[3]{\mathsf{fma}\left(\frac{y}{t}, b, a\right) + 1} \cdot \sqrt[3]{\mathsf{fma}\left(\frac{y}{t}, b, a\right) + 1}}{\sqrt[3]{\mathsf{fma}\left(\frac{y}{t}, z, x\right)} \cdot \sqrt[3]{\mathsf{fma}\left(\frac{y}{t}, z, x\right)}} \cdot \frac{\sqrt[3]{\mathsf{fma}\left(\frac{y}{t}, b, a\right) + 1}}{\sqrt[3]{\mathsf{fma}\left(\frac{y}{t}, z, x\right)}}}\]
    10. Applied times-frac4.4

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

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

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

    if -1.308807350299646e+41 < t < 3.25378864706342e+83

    1. Initial program 20.5

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

    if 3.25378864706342e+83 < t

    1. Initial program 11.3

      \[\frac{x + \frac{y \cdot z}{t}}{\left(a + 1\right) + \frac{y \cdot b}{t}}\]
    2. Simplified2.4

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

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

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

Reproduce

herbie shell --seed 2019235 +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.0369671037372459e-130) (/ z b) (* 1 (* (+ x (* (/ y t) z)) (/ 1 (+ (+ a 1) (* (/ y t) b)))))))

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