Average Error: 0.0 → 0.0
Time: 5.2s
Precision: 64
\[\left(x \cdot y + x\right) + y\]
\[\mathsf{fma}\left(x, y, x + y\right)\]
\left(x \cdot y + x\right) + y
\mathsf{fma}\left(x, y, x + y\right)
double f(double x, double y) {
        double r62223 = x;
        double r62224 = y;
        double r62225 = r62223 * r62224;
        double r62226 = r62225 + r62223;
        double r62227 = r62226 + r62224;
        return r62227;
}

double f(double x, double y) {
        double r62228 = x;
        double r62229 = y;
        double r62230 = r62228 + r62229;
        double r62231 = fma(r62228, r62229, r62230);
        return r62231;
}

Error

Bits error versus x

Bits error versus y

Derivation

  1. Initial program 0.0

    \[\left(x \cdot y + x\right) + y\]
  2. Taylor expanded around 0 0.0

    \[\leadsto \color{blue}{x + \left(y + x \cdot y\right)}\]
  3. Simplified0.0

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

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

Reproduce

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