Average Error: 0.0 → 0.0
Time: 22.7s
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 r3890755 = x;
        double r3890756 = y;
        double r3890757 = r3890755 * r3890756;
        double r3890758 = r3890757 + r3890755;
        double r3890759 = r3890758 + r3890756;
        return r3890759;
}

double f(double x, double y) {
        double r3890760 = y;
        double r3890761 = x;
        double r3890762 = r3890761 + r3890760;
        double r3890763 = fma(r3890760, r3890761, r3890762);
        return r3890763;
}

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 2019163 +o rules:numerics
(FPCore (x y)
  :name "Numeric.Log:$cexpm1 from log-domain-0.10.2.1, B"
  (+ (+ (* x y) x) y))