Average Error: 0.0 → 0.0
Time: 24.0s
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 r489890 = x;
        double r489891 = y;
        double r489892 = z;
        double r489893 = r489891 - r489892;
        double r489894 = t;
        double r489895 = r489894 - r489890;
        double r489896 = r489893 * r489895;
        double r489897 = r489890 + r489896;
        return r489897;
}

double f(double x, double y, double z, double t) {
        double r489898 = y;
        double r489899 = z;
        double r489900 = r489898 - r489899;
        double r489901 = t;
        double r489902 = x;
        double r489903 = r489901 - r489902;
        double r489904 = fma(r489900, r489903, r489902);
        return r489904;
}

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