Average Error: 0.0 → 0.0
Time: 751.0ms
Precision: 64
\[\left(x \cdot y + x\right) + y\]
\[\mathsf{fma}\left(x + 1, y, x\right)\]
\left(x \cdot y + x\right) + y
\mathsf{fma}\left(x + 1, y, x\right)
double f(double x, double y) {
        double r104162 = x;
        double r104163 = y;
        double r104164 = r104162 * r104163;
        double r104165 = r104164 + r104162;
        double r104166 = r104165 + r104163;
        return r104166;
}

double f(double x, double y) {
        double r104167 = x;
        double r104168 = 1.0;
        double r104169 = r104167 + r104168;
        double r104170 = y;
        double r104171 = fma(r104169, r104170, r104167);
        return r104171;
}

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

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

Reproduce

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