Average Error: 0.0 → 0.0
Time: 7.0s
Precision: 64
\[\left(x \cdot y + x\right) + y\]
\[\mathsf{fma}\left(x, y, x\right) + y\]
\left(x \cdot y + x\right) + y
\mathsf{fma}\left(x, y, x\right) + y
double f(double x, double y) {
        double r118658 = x;
        double r118659 = y;
        double r118660 = r118658 * r118659;
        double r118661 = r118660 + r118658;
        double r118662 = r118661 + r118659;
        return r118662;
}

double f(double x, double y) {
        double r118663 = x;
        double r118664 = y;
        double r118665 = fma(r118663, r118664, r118663);
        double r118666 = r118665 + r118664;
        return r118666;
}

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. Final simplification0.0

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

Reproduce

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