Average Error: 0.0 → 0.0
Time: 8.7s
Precision: 64
\[\left(x \cdot y + x\right) + y\]
\[\mathsf{fma}\left(y, x, x + y\right)\]
\left(x \cdot y + x\right) + y
\mathsf{fma}\left(y, x, x + y\right)
double f(double x, double y) {
        double r4659500 = x;
        double r4659501 = y;
        double r4659502 = r4659500 * r4659501;
        double r4659503 = r4659502 + r4659500;
        double r4659504 = r4659503 + r4659501;
        return r4659504;
}

double f(double x, double y) {
        double r4659505 = y;
        double r4659506 = x;
        double r4659507 = r4659506 + r4659505;
        double r4659508 = fma(r4659505, r4659506, r4659507);
        return r4659508;
}

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(y, x, x + y\right)}\]
  3. Final simplification0.0

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

Reproduce

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