Average Error: 0.0 → 0.0
Time: 23.4s
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 r3911466 = x;
        double r3911467 = y;
        double r3911468 = r3911466 * r3911467;
        double r3911469 = r3911468 + r3911466;
        double r3911470 = r3911469 + r3911467;
        return r3911470;
}

double f(double x, double y) {
        double r3911471 = y;
        double r3911472 = x;
        double r3911473 = r3911472 + r3911471;
        double r3911474 = fma(r3911471, r3911472, r3911473);
        return r3911474;
}

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}{y + \mathsf{fma}\left(y, x, x\right)}\]
  3. Taylor expanded around 0 0.0

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

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

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

Reproduce

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