Average Error: 0.0 → 0.0
Time: 502.0ms
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 r816047 = x;
        double r816048 = r816047 * r816047;
        double r816049 = y;
        double r816050 = r816048 + r816049;
        double r816051 = r816050 + r816049;
        return r816051;
}

double f(double x, double y) {
        double r816052 = y;
        double r816053 = x;
        double r816054 = fma(r816053, r816053, r816052);
        double r816055 = r816052 + r816054;
        return r816055;
}

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

Reproduce

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

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

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