Average Error: 0.0 → 0.0
Time: 45.7s
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 r36222034 = x;
        double r36222035 = y;
        double r36222036 = z;
        double r36222037 = r36222035 - r36222036;
        double r36222038 = t;
        double r36222039 = r36222038 - r36222034;
        double r36222040 = r36222037 * r36222039;
        double r36222041 = r36222034 + r36222040;
        return r36222041;
}

double f(double x, double y, double z, double t) {
        double r36222042 = t;
        double r36222043 = x;
        double r36222044 = r36222042 - r36222043;
        double r36222045 = y;
        double r36222046 = z;
        double r36222047 = r36222045 - r36222046;
        double r36222048 = fma(r36222044, r36222047, r36222043);
        return r36222048;
}

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 2019200 +o rules:numerics
(FPCore (x y z t)
  :name "Data.Metrics.Snapshot:quantile from metrics-0.3.0.2"

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

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