Average Error: 0.0 → 0.0
Time: 9.7s
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 r92607 = x;
        double r92608 = y;
        double r92609 = r92607 * r92608;
        double r92610 = r92609 + r92607;
        double r92611 = r92610 + r92608;
        return r92611;
}

double f(double x, double y) {
        double r92612 = x;
        double r92613 = y;
        double r92614 = r92612 + r92613;
        double r92615 = fma(r92612, r92613, r92614);
        return r92615;
}

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. Using strategy rm
  4. Applied fma-udef0.0

    \[\leadsto \color{blue}{\left(x \cdot y + x\right)} + y\]
  5. Applied associate-+l+0.0

    \[\leadsto \color{blue}{x \cdot y + \left(x + y\right)}\]
  6. Using strategy rm
  7. Applied fma-def0.0

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

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

Reproduce

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