Average Error: 0.0 → 0.0
Time: 5.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 r33341543 = x;
        double r33341544 = r33341543 * r33341543;
        double r33341545 = y;
        double r33341546 = r33341544 + r33341545;
        double r33341547 = r33341546 + r33341545;
        return r33341547;
}

double f(double x, double y) {
        double r33341548 = y;
        double r33341549 = x;
        double r33341550 = fma(r33341549, r33341549, r33341548);
        double r33341551 = r33341548 + r33341550;
        return r33341551;
}

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 2019164 +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))