Average Error: 0.0 → 0.0
Time: 414.0ms
Precision: 64
\[\left(x \cdot y + x\right) + y\]
\[\mathsf{fma}\left(x, y, x\right) + y\]
\left(x \cdot y + x\right) + y
\mathsf{fma}\left(x, y, x\right) + y
double f(double x, double y) {
        double r118252 = x;
        double r118253 = y;
        double r118254 = r118252 * r118253;
        double r118255 = r118254 + r118252;
        double r118256 = r118255 + r118253;
        return r118256;
}

double f(double x, double y) {
        double r118257 = x;
        double r118258 = y;
        double r118259 = fma(r118257, r118258, r118257);
        double r118260 = r118259 + r118258;
        return r118260;
}

Error

Bits error versus x

Bits error versus y

Derivation

  1. Initial program 0.0

    \[\left(x \cdot y + x\right) + y\]
  2. Simplified0.0

    \[\leadsto \color{blue}{\mathsf{fma}\left(x, y, x\right) + y}\]
  3. Final simplification0.0

    \[\leadsto \mathsf{fma}\left(x, y, x\right) + y\]

Reproduce

herbie shell --seed 2020045 +o rules:numerics
(FPCore (x y)
  :name "Numeric.Log:$cexpm1 from log-domain-0.10.2.1, B"
  :precision binary64
  (+ (+ (* x y) x) y))