Average Error: 0.0 → 0.0
Time: 8.1s
Precision: 64
\[\left(x \cdot x + y\right) + y\]
\[y + \mathsf{fma}\left(x, x, y\right)\]
\left(x \cdot x + y\right) + y
y + \mathsf{fma}\left(x, x, y\right)
double f(double x, double y) {
        double r33069556 = x;
        double r33069557 = r33069556 * r33069556;
        double r33069558 = y;
        double r33069559 = r33069557 + r33069558;
        double r33069560 = r33069559 + r33069558;
        return r33069560;
}

double f(double x, double y) {
        double r33069561 = y;
        double r33069562 = x;
        double r33069563 = fma(r33069562, r33069562, r33069561);
        double r33069564 = r33069561 + r33069563;
        return r33069564;
}

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}{\mathsf{fma}\left(x, x, y\right) + y}\]
  3. Final simplification0.0

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

Reproduce

herbie shell --seed 2019169 +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))