Average Error: 0.0 → 0.0
Time: 3.1s
Precision: 64
\[\left(x \cdot 2 + x \cdot x\right) + y \cdot y\]
\[\mathsf{fma}\left(x, 2 + x, y \cdot y\right)\]
\left(x \cdot 2 + x \cdot x\right) + y \cdot y
\mathsf{fma}\left(x, 2 + x, y \cdot y\right)
double f(double x, double y) {
        double r281034 = x;
        double r281035 = 2.0;
        double r281036 = r281034 * r281035;
        double r281037 = r281034 * r281034;
        double r281038 = r281036 + r281037;
        double r281039 = y;
        double r281040 = r281039 * r281039;
        double r281041 = r281038 + r281040;
        return r281041;
}

double f(double x, double y) {
        double r281042 = x;
        double r281043 = 2.0;
        double r281044 = r281043 + r281042;
        double r281045 = y;
        double r281046 = r281045 * r281045;
        double r281047 = fma(r281042, r281044, r281046);
        return r281047;
}

Error

Bits error versus x

Bits error versus y

Target

Original0.0
Target0.0
Herbie0.0
\[y \cdot y + \left(2 \cdot x + x \cdot x\right)\]

Derivation

  1. Initial program 0.0

    \[\left(x \cdot 2 + x \cdot x\right) + y \cdot y\]
  2. Simplified0.0

    \[\leadsto \color{blue}{\mathsf{fma}\left(x, 2 + x, y \cdot y\right)}\]
  3. Final simplification0.0

    \[\leadsto \mathsf{fma}\left(x, 2 + x, y \cdot y\right)\]

Reproduce

herbie shell --seed 2019323 +o rules:numerics
(FPCore (x y)
  :name "Numeric.Log:$clog1p from log-domain-0.10.2.1, A"
  :precision binary64

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

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