Average Error: 0.0 → 0.0
Time: 32.7s
Precision: 64
\[x + \left(y - z\right) \cdot \left(t - x\right)\]
\[\mathsf{fma}\left(y - z, t - x, x\right)\]
x + \left(y - z\right) \cdot \left(t - x\right)
\mathsf{fma}\left(y - z, t - x, x\right)
double f(double x, double y, double z, double t) {
        double r363609 = x;
        double r363610 = y;
        double r363611 = z;
        double r363612 = r363610 - r363611;
        double r363613 = t;
        double r363614 = r363613 - r363609;
        double r363615 = r363612 * r363614;
        double r363616 = r363609 + r363615;
        return r363616;
}

double f(double x, double y, double z, double t) {
        double r363617 = y;
        double r363618 = z;
        double r363619 = r363617 - r363618;
        double r363620 = t;
        double r363621 = x;
        double r363622 = r363620 - r363621;
        double r363623 = fma(r363619, r363622, r363621);
        return r363623;
}

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(y - z, t - x, x\right)}\]
  3. Final simplification0.0

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

Reproduce

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