Average Error: 0.0 → 0.0
Time: 4.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 r16007227 = x;
        double r16007228 = y;
        double r16007229 = z;
        double r16007230 = r16007228 - r16007229;
        double r16007231 = t;
        double r16007232 = r16007231 - r16007227;
        double r16007233 = r16007230 * r16007232;
        double r16007234 = r16007227 + r16007233;
        return r16007234;
}

double f(double x, double y, double z, double t) {
        double r16007235 = t;
        double r16007236 = x;
        double r16007237 = r16007235 - r16007236;
        double r16007238 = y;
        double r16007239 = z;
        double r16007240 = r16007238 - r16007239;
        double r16007241 = fma(r16007237, r16007240, r16007236);
        return r16007241;
}

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