Average Error: 23.2 → 23.2
Time: 23.9s
Precision: 64
\[\frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)}\]
\[\frac{\mathsf{fma}\left(y, x, z \cdot \left(t - a\right)\right)}{\mathsf{fma}\left(z, b - y, y\right)}\]
\frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)}
\frac{\mathsf{fma}\left(y, x, z \cdot \left(t - a\right)\right)}{\mathsf{fma}\left(z, b - y, y\right)}
double f(double x, double y, double z, double t, double a, double b) {
        double r33563572 = x;
        double r33563573 = y;
        double r33563574 = r33563572 * r33563573;
        double r33563575 = z;
        double r33563576 = t;
        double r33563577 = a;
        double r33563578 = r33563576 - r33563577;
        double r33563579 = r33563575 * r33563578;
        double r33563580 = r33563574 + r33563579;
        double r33563581 = b;
        double r33563582 = r33563581 - r33563573;
        double r33563583 = r33563575 * r33563582;
        double r33563584 = r33563573 + r33563583;
        double r33563585 = r33563580 / r33563584;
        return r33563585;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r33563586 = y;
        double r33563587 = x;
        double r33563588 = z;
        double r33563589 = t;
        double r33563590 = a;
        double r33563591 = r33563589 - r33563590;
        double r33563592 = r33563588 * r33563591;
        double r33563593 = fma(r33563586, r33563587, r33563592);
        double r33563594 = b;
        double r33563595 = r33563594 - r33563586;
        double r33563596 = fma(r33563588, r33563595, r33563586);
        double r33563597 = r33563593 / r33563596;
        return r33563597;
}

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.2
\[\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. Initial program 23.2

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

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

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

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