Average Error: 0.0 → 0.0
Time: 3.5s
Precision: 64
\[\left(x \cdot y + x\right) + y\]
\[\mathsf{fma}\left(y, x, x + y\right)\]
\left(x \cdot y + x\right) + y
\mathsf{fma}\left(y, x, x + y\right)
double f(double x, double y) {
        double r2972143 = x;
        double r2972144 = y;
        double r2972145 = r2972143 * r2972144;
        double r2972146 = r2972145 + r2972143;
        double r2972147 = r2972146 + r2972144;
        return r2972147;
}

double f(double x, double y) {
        double r2972148 = y;
        double r2972149 = x;
        double r2972150 = r2972149 + r2972148;
        double r2972151 = fma(r2972148, r2972149, r2972150);
        return r2972151;
}

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(y, x, x + y\right)}\]
  3. Final simplification0.0

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

Reproduce

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