Average Error: 23.2 → 23.2
Time: 26.6s
Precision: 64
\[\frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)}\]
\[\frac{\mathsf{fma}\left(x, y, 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(x, y, 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 r579018 = x;
        double r579019 = y;
        double r579020 = r579018 * r579019;
        double r579021 = z;
        double r579022 = t;
        double r579023 = a;
        double r579024 = r579022 - r579023;
        double r579025 = r579021 * r579024;
        double r579026 = r579020 + r579025;
        double r579027 = b;
        double r579028 = r579027 - r579019;
        double r579029 = r579021 * r579028;
        double r579030 = r579019 + r579029;
        double r579031 = r579026 / r579030;
        return r579031;
}

double f(double x, double y, double z, double t, double a, double b) {
        double r579032 = x;
        double r579033 = y;
        double r579034 = z;
        double r579035 = t;
        double r579036 = a;
        double r579037 = r579035 - r579036;
        double r579038 = r579034 * r579037;
        double r579039 = fma(r579032, r579033, r579038);
        double r579040 = b;
        double r579041 = r579040 - r579033;
        double r579042 = fma(r579034, r579041, r579033);
        double r579043 = r579039 / r579042;
        return r579043;
}

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.7
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(x, y, z \cdot \left(t - a\right)\right)}{\mathsf{fma}\left(z, b - y, y\right)}}\]
  3. Final simplification23.2

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

Reproduce

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