Average Error: 0.0 → 0.0
Time: 1.4s
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 r23030627 = x;
        double r23030628 = r23030627 * r23030627;
        double r23030629 = y;
        double r23030630 = r23030628 + r23030629;
        double r23030631 = r23030630 + r23030629;
        return r23030631;
}

double f(double x, double y) {
        double r23030632 = y;
        double r23030633 = x;
        double r23030634 = fma(r23030633, r23030633, r23030632);
        double r23030635 = r23030632 + r23030634;
        return r23030635;
}

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