Average Error: 0.0 → 0.0
Time: 1.4s
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 r60331 = x;
        double r60332 = y;
        double r60333 = r60331 * r60332;
        double r60334 = r60333 + r60331;
        double r60335 = r60334 + r60332;
        return r60335;
}

double f(double x, double y) {
        double r60336 = x;
        double r60337 = y;
        double r60338 = fma(r60336, r60337, r60336);
        double r60339 = r60338 + r60337;
        return r60339;
}

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