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 r76178 = x;
        double r76179 = y;
        double r76180 = r76178 * r76179;
        double r76181 = r76180 + r76178;
        double r76182 = r76181 + r76179;
        return r76182;
}

double f(double x, double y) {
        double r76183 = x;
        double r76184 = y;
        double r76185 = r76183 + r76184;
        double r76186 = fma(r76183, r76184, r76185);
        return r76186;
}

Error

Bits error versus x

Bits error versus y

Derivation

  1. Initial program 0.0

    \[\left(x \cdot y + x\right) + y\]
  2. Using strategy rm
  3. Applied *-un-lft-identity0.0

    \[\leadsto \left(x \cdot y + x\right) + \color{blue}{1 \cdot y}\]
  4. Applied *-un-lft-identity0.0

    \[\leadsto \color{blue}{1 \cdot \left(x \cdot y + x\right)} + 1 \cdot y\]
  5. Applied distribute-lft-out0.0

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

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

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

Reproduce

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