Average Error: 0.0 → 0.0
Time: 6.2s
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 r26403961 = x;
        double r26403962 = r26403961 * r26403961;
        double r26403963 = y;
        double r26403964 = r26403962 + r26403963;
        double r26403965 = r26403964 + r26403963;
        return r26403965;
}

double f(double x, double y) {
        double r26403966 = y;
        double r26403967 = x;
        double r26403968 = fma(r26403967, r26403967, r26403966);
        double r26403969 = r26403966 + r26403968;
        return r26403969;
}

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