Average Error: 0.0 → 0.0
Time: 5.8s
Precision: 64
\[x + \left(y - z\right) \cdot \left(t - x\right)\]
\[\mathsf{fma}\left(t - x, y - z, x\right)\]
x + \left(y - z\right) \cdot \left(t - x\right)
\mathsf{fma}\left(t - x, y - z, x\right)
double f(double x, double y, double z, double t) {
        double r887991 = x;
        double r887992 = y;
        double r887993 = z;
        double r887994 = r887992 - r887993;
        double r887995 = t;
        double r887996 = r887995 - r887991;
        double r887997 = r887994 * r887996;
        double r887998 = r887991 + r887997;
        return r887998;
}

double f(double x, double y, double z, double t) {
        double r887999 = t;
        double r888000 = x;
        double r888001 = r887999 - r888000;
        double r888002 = y;
        double r888003 = z;
        double r888004 = r888002 - r888003;
        double r888005 = fma(r888001, r888004, r888000);
        return r888005;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Target

Original0.0
Target0.0
Herbie0.0
\[x + \left(t \cdot \left(y - z\right) + \left(-x\right) \cdot \left(y - z\right)\right)\]

Derivation

  1. Initial program 0.0

    \[x + \left(y - z\right) \cdot \left(t - x\right)\]
  2. Simplified0.0

    \[\leadsto \color{blue}{\mathsf{fma}\left(t - x, y - z, x\right)}\]
  3. Final simplification0.0

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

Reproduce

herbie shell --seed 2020002 +o rules:numerics
(FPCore (x y z t)
  :name "Data.Metrics.Snapshot:quantile from metrics-0.3.0.2"
  :precision binary64

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

  (+ x (* (- y z) (- t x))))