Average Error: 0.0 → 0.0
Time: 26.5s
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 r4366908 = x;
        double r4366909 = y;
        double r4366910 = r4366908 * r4366909;
        double r4366911 = r4366910 + r4366908;
        double r4366912 = r4366911 + r4366909;
        return r4366912;
}

double f(double x, double y) {
        double r4366913 = x;
        double r4366914 = y;
        double r4366915 = fma(r4366913, r4366914, r4366914);
        double r4366916 = r4366913 + r4366915;
        return r4366916;
}

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 2019170 +o rules:numerics
(FPCore (x y)
  :name "Numeric.Log:$cexpm1 from log-domain-0.10.2.1, B"
  (+ (+ (* x y) x) y))