Average Error: 0.0 → 0.0
Time: 521.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 r992908 = x;
        double r992909 = r992908 * r992908;
        double r992910 = y;
        double r992911 = r992909 + r992910;
        double r992912 = r992911 + r992910;
        return r992912;
}

double f(double x, double y) {
        double r992913 = y;
        double r992914 = x;
        double r992915 = fma(r992914, r992914, r992913);
        double r992916 = r992913 + r992915;
        return r992916;
}

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