Average Error: 16.7 → 13.0
Time: 19.0s
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 -639745286380092860028420096 \lor \neg \left(t \le 1.788239029020921775794321335911618969662 \cdot 10^{-59}\right):\\ \;\;\;\;\frac{\mathsf{fma}\left(\frac{z}{t}, y, x\right)}{\mathsf{fma}\left(\frac{y}{t}, b, a\right) + 1}\\ \mathbf{else}:\\ \;\;\;\;\frac{x + \frac{y \cdot z}{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}\;t \le -639745286380092860028420096 \lor \neg \left(t \le 1.788239029020921775794321335911618969662 \cdot 10^{-59}\right):\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{z}{t}, y, x\right)}{\mathsf{fma}\left(\frac{y}{t}, b, a\right) + 1}\\

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

\end{array}
double f(double x, double y, double z, double t, double a, double b) {
        double r491582 = x;
        double r491583 = y;
        double r491584 = z;
        double r491585 = r491583 * r491584;
        double r491586 = t;
        double r491587 = r491585 / r491586;
        double r491588 = r491582 + r491587;
        double r491589 = a;
        double r491590 = 1.0;
        double r491591 = r491589 + r491590;
        double r491592 = b;
        double r491593 = r491583 * r491592;
        double r491594 = r491593 / r491586;
        double r491595 = r491591 + r491594;
        double r491596 = r491588 / r491595;
        return r491596;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r491597 = t;
        double r491598 = -6.397452863800929e+26;
        bool r491599 = r491597 <= r491598;
        double r491600 = 1.7882390290209218e-59;
        bool r491601 = r491597 <= r491600;
        double r491602 = !r491601;
        bool r491603 = r491599 || r491602;
        double r491604 = z;
        double r491605 = r491604 / r491597;
        double r491606 = y;
        double r491607 = x;
        double r491608 = fma(r491605, r491606, r491607);
        double r491609 = r491606 / r491597;
        double r491610 = b;
        double r491611 = a;
        double r491612 = fma(r491609, r491610, r491611);
        double r491613 = 1.0;
        double r491614 = r491612 + r491613;
        double r491615 = r491608 / r491614;
        double r491616 = r491606 * r491604;
        double r491617 = r491616 / r491597;
        double r491618 = r491607 + r491617;
        double r491619 = r491611 + r491613;
        double r491620 = r491606 * r491610;
        double r491621 = r491620 / r491597;
        double r491622 = r491619 + r491621;
        double r491623 = r491618 / r491622;
        double r491624 = r491603 ? r491615 : r491623;
        return r491624;
}

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.7
Target13.4
Herbie13.0
\[\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 2 regimes
  2. if t < -6.397452863800929e+26 or 1.7882390290209218e-59 < t

    1. Initial program 11.9

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

      \[\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-num5.4

      \[\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 *-un-lft-identity5.4

      \[\leadsto \frac{1}{\frac{\mathsf{fma}\left(\frac{y}{t}, b, a\right) + 1}{\color{blue}{1 \cdot \mathsf{fma}\left(\frac{y}{t}, z, x\right)}}}\]
    7. Applied *-un-lft-identity5.4

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

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

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

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

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

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

    if -6.397452863800929e+26 < t < 1.7882390290209218e-59

    1. Initial program 22.5

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

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

Reproduce

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