Average Error: 0.0 → 0.0
Time: 25.9s
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 r5079503 = x;
        double r5079504 = y;
        double r5079505 = r5079503 * r5079504;
        double r5079506 = r5079505 + r5079503;
        double r5079507 = r5079506 + r5079504;
        return r5079507;
}

double f(double x, double y) {
        double r5079508 = y;
        double r5079509 = x;
        double r5079510 = r5079509 + r5079508;
        double r5079511 = fma(r5079508, r5079509, r5079510);
        return r5079511;
}

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. Taylor expanded around 0 0.0

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

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

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

Reproduce

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