Average Error: 0.0 → 0.0
Time: 5.6s
Precision: 64
\[\left(x \cdot y + x\right) + y\]
\[x + \mathsf{fma}\left(x, y, y\right)\]
\left(x \cdot y + x\right) + y
x + \mathsf{fma}\left(x, y, y\right)
double f(double x, double y) {
        double r4348801 = x;
        double r4348802 = y;
        double r4348803 = r4348801 * r4348802;
        double r4348804 = r4348803 + r4348801;
        double r4348805 = r4348804 + r4348802;
        return r4348805;
}

double f(double x, double y) {
        double r4348806 = x;
        double r4348807 = y;
        double r4348808 = fma(r4348806, r4348807, r4348807);
        double r4348809 = r4348806 + r4348808;
        return r4348809;
}

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

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

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

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

    \[\leadsto x + \mathsf{fma}\left(x, y, 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))