Average Error: 0.0 → 0.0
Time: 58.6s
Precision: 64
\[\left(x \cdot y + x\right) + y\]
\[\mathsf{fma}\left(x, y, y + x\right)\]
\left(x \cdot y + x\right) + y
\mathsf{fma}\left(x, y, y + x\right)
double f(double x, double y) {
        double r4777972 = x;
        double r4777973 = y;
        double r4777974 = r4777972 * r4777973;
        double r4777975 = r4777974 + r4777972;
        double r4777976 = r4777975 + r4777973;
        return r4777976;
}

double f(double x, double y) {
        double r4777977 = x;
        double r4777978 = y;
        double r4777979 = r4777978 + r4777977;
        double r4777980 = fma(r4777977, r4777978, r4777979);
        return r4777980;
}

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

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

Reproduce

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