Average Error: 23.2 → 23.1
Time: 25.3s
Precision: 64
\[\frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)}\]
\[\begin{array}{l} \mathbf{if}\;y \le 2.693035395822541200337105533352396195819 \cdot 10^{122}:\\ \;\;\;\;\frac{\mathsf{fma}\left(z, t - a, x \cdot y\right)}{\mathsf{fma}\left(b - y, z, y\right)}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array}\]
\frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)}
\begin{array}{l}
\mathbf{if}\;y \le 2.693035395822541200337105533352396195819 \cdot 10^{122}:\\
\;\;\;\;\frac{\mathsf{fma}\left(z, t - a, x \cdot y\right)}{\mathsf{fma}\left(b - y, z, y\right)}\\

\mathbf{else}:\\
\;\;\;\;x\\

\end{array}
double f(double x, double y, double z, double t, double a, double b) {
        double r32477814 = x;
        double r32477815 = y;
        double r32477816 = r32477814 * r32477815;
        double r32477817 = z;
        double r32477818 = t;
        double r32477819 = a;
        double r32477820 = r32477818 - r32477819;
        double r32477821 = r32477817 * r32477820;
        double r32477822 = r32477816 + r32477821;
        double r32477823 = b;
        double r32477824 = r32477823 - r32477815;
        double r32477825 = r32477817 * r32477824;
        double r32477826 = r32477815 + r32477825;
        double r32477827 = r32477822 / r32477826;
        return r32477827;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r32477828 = y;
        double r32477829 = 2.6930353958225412e+122;
        bool r32477830 = r32477828 <= r32477829;
        double r32477831 = z;
        double r32477832 = t;
        double r32477833 = a;
        double r32477834 = r32477832 - r32477833;
        double r32477835 = x;
        double r32477836 = r32477835 * r32477828;
        double r32477837 = fma(r32477831, r32477834, r32477836);
        double r32477838 = b;
        double r32477839 = r32477838 - r32477828;
        double r32477840 = fma(r32477839, r32477831, r32477828);
        double r32477841 = r32477837 / r32477840;
        double r32477842 = r32477830 ? r32477841 : r32477835;
        return r32477842;
}

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

Original23.2
Target17.9
Herbie23.1
\[\frac{z \cdot t + y \cdot x}{y + z \cdot \left(b - y\right)} - \frac{a}{\left(b - y\right) + \frac{y}{z}}\]

Derivation

  1. Split input into 2 regimes
  2. if y < 2.6930353958225412e+122

    1. Initial program 20.6

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

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

    if 2.6930353958225412e+122 < y

    1. Initial program 36.8

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

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(z, t - a, x \cdot y\right)}{\mathsf{fma}\left(b - y, z, y\right)}}\]
    3. Taylor expanded around 0 35.7

      \[\leadsto \color{blue}{x}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification23.1

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \le 2.693035395822541200337105533352396195819 \cdot 10^{122}:\\ \;\;\;\;\frac{\mathsf{fma}\left(z, t - a, x \cdot y\right)}{\mathsf{fma}\left(b - y, z, y\right)}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array}\]

Reproduce

herbie shell --seed 2019172 +o rules:numerics
(FPCore (x y z t a b)
  :name "Development.Shake.Progress:decay from shake-0.15.5"

  :herbie-target
  (- (/ (+ (* z t) (* y x)) (+ y (* z (- b y)))) (/ a (+ (- b y) (/ y z))))

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