Average Error: 0.0 → 0.0
Time: 17.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 r519859 = x;
        double r519860 = y;
        double r519861 = z;
        double r519862 = r519860 - r519861;
        double r519863 = t;
        double r519864 = r519863 - r519859;
        double r519865 = r519862 * r519864;
        double r519866 = r519859 + r519865;
        return r519866;
}

double f(double x, double y, double z, double t) {
        double r519867 = y;
        double r519868 = z;
        double r519869 = r519867 - r519868;
        double r519870 = t;
        double r519871 = x;
        double r519872 = r519870 - r519871;
        double r519873 = fma(r519869, r519872, r519871);
        return r519873;
}

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