Average Error: 0.0 → 0.0
Time: 18.7s
Precision: 64
\[\left(x \cdot x + y\right) + y\]
\[\mathsf{fma}\left(x, x, y\right) + y\]
\left(x \cdot x + y\right) + y
\mathsf{fma}\left(x, x, y\right) + y
double f(double x, double y) {
        double r35105537 = x;
        double r35105538 = r35105537 * r35105537;
        double r35105539 = y;
        double r35105540 = r35105538 + r35105539;
        double r35105541 = r35105540 + r35105539;
        return r35105541;
}

double f(double x, double y) {
        double r35105542 = x;
        double r35105543 = y;
        double r35105544 = fma(r35105542, r35105542, r35105543);
        double r35105545 = r35105544 + r35105543;
        return r35105545;
}

Error

Bits error versus x

Bits error versus y

Target

Original0.0
Target0.0
Herbie0.0
\[\left(y + y\right) + x \cdot x\]

Derivation

  1. Initial program 0.0

    \[\left(x \cdot x + y\right) + y\]
  2. Simplified0.0

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

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

Reproduce

herbie shell --seed 2019200 +o rules:numerics
(FPCore (x y)
  :name "Data.Random.Distribution.Normal:normalTail from random-fu-0.2.6.2"

  :herbie-target
  (+ (+ y y) (* x x))

  (+ (+ (* x x) y) y))