Average Error: 0.0 → 0.0
Time: 11.3s
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 r21347567 = x;
        double r21347568 = y;
        double r21347569 = z;
        double r21347570 = r21347568 - r21347569;
        double r21347571 = t;
        double r21347572 = r21347571 - r21347567;
        double r21347573 = r21347570 * r21347572;
        double r21347574 = r21347567 + r21347573;
        return r21347574;
}

double f(double x, double y, double z, double t) {
        double r21347575 = t;
        double r21347576 = x;
        double r21347577 = r21347575 - r21347576;
        double r21347578 = y;
        double r21347579 = z;
        double r21347580 = r21347578 - r21347579;
        double r21347581 = fma(r21347577, r21347580, r21347576);
        return r21347581;
}

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