Average Error: 0.0 → 0.0
Time: 29.2s
Precision: 64
\[\left(x \cdot y + x\right) + y\]
\[\mathsf{fma}\left(x, y, y\right) + x\]
\left(x \cdot y + x\right) + y
\mathsf{fma}\left(x, y, y\right) + x
double f(double x, double y) {
        double r14185891 = x;
        double r14185892 = y;
        double r14185893 = r14185891 * r14185892;
        double r14185894 = r14185893 + r14185891;
        double r14185895 = r14185894 + r14185892;
        return r14185895;
}

double f(double x, double y) {
        double r14185896 = x;
        double r14185897 = y;
        double r14185898 = fma(r14185896, r14185897, r14185897);
        double r14185899 = r14185898 + r14185896;
        return r14185899;
}

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. Using strategy rm
  4. Applied fma-udef0.0

    \[\leadsto y + \color{blue}{\left(x \cdot y + x\right)}\]
  5. Applied associate-+r+0.0

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

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

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

Reproduce

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