Average Error: 0.0 → 0.0
Time: 18.9s
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 r491771 = x;
        double r491772 = y;
        double r491773 = z;
        double r491774 = r491772 - r491773;
        double r491775 = t;
        double r491776 = r491775 - r491771;
        double r491777 = r491774 * r491776;
        double r491778 = r491771 + r491777;
        return r491778;
}

double f(double x, double y, double z, double t) {
        double r491779 = y;
        double r491780 = z;
        double r491781 = r491779 - r491780;
        double r491782 = t;
        double r491783 = x;
        double r491784 = r491782 - r491783;
        double r491785 = fma(r491781, r491784, r491783);
        return r491785;
}

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