Average Error: 0.0 → 0.0
Time: 13.5s
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 r35066002 = x;
        double r35066003 = y;
        double r35066004 = z;
        double r35066005 = r35066003 - r35066004;
        double r35066006 = t;
        double r35066007 = r35066006 - r35066002;
        double r35066008 = r35066005 * r35066007;
        double r35066009 = r35066002 + r35066008;
        return r35066009;
}

double f(double x, double y, double z, double t) {
        double r35066010 = t;
        double r35066011 = x;
        double r35066012 = r35066010 - r35066011;
        double r35066013 = y;
        double r35066014 = z;
        double r35066015 = r35066013 - r35066014;
        double r35066016 = fma(r35066012, r35066015, r35066011);
        return r35066016;
}

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