Average Error: 23.2 → 23.1
Time: 22.9s
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 r34292815 = x;
        double r34292816 = y;
        double r34292817 = r34292815 * r34292816;
        double r34292818 = z;
        double r34292819 = t;
        double r34292820 = a;
        double r34292821 = r34292819 - r34292820;
        double r34292822 = r34292818 * r34292821;
        double r34292823 = r34292817 + r34292822;
        double r34292824 = b;
        double r34292825 = r34292824 - r34292816;
        double r34292826 = r34292818 * r34292825;
        double r34292827 = r34292816 + r34292826;
        double r34292828 = r34292823 / r34292827;
        return r34292828;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r34292829 = y;
        double r34292830 = 2.6930353958225412e+122;
        bool r34292831 = r34292829 <= r34292830;
        double r34292832 = z;
        double r34292833 = t;
        double r34292834 = a;
        double r34292835 = r34292833 - r34292834;
        double r34292836 = x;
        double r34292837 = r34292836 * r34292829;
        double r34292838 = fma(r34292832, r34292835, r34292837);
        double r34292839 = b;
        double r34292840 = r34292839 - r34292829;
        double r34292841 = fma(r34292840, r34292832, r34292829);
        double r34292842 = r34292838 / r34292841;
        double r34292843 = r34292831 ? r34292842 : r34292836;
        return r34292843;
}

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)))))