Average Error: 0.0 → 0.0
Time: 5.2s
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 r98375 = x;
        double r98376 = y;
        double r98377 = r98375 * r98376;
        double r98378 = r98377 + r98375;
        double r98379 = r98378 + r98376;
        return r98379;
}

double f(double x, double y) {
        double r98380 = x;
        double r98381 = y;
        double r98382 = fma(r98380, r98381, r98380);
        double r98383 = r98382 + r98381;
        return r98383;
}

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 2019306 +o rules:numerics
(FPCore (x y)
  :name "Numeric.Log:$cexpm1 from log-domain-0.10.2.1, B"
  :precision binary64
  (+ (+ (* x y) x) y))