Average Error: 0.0 → 0.0
Time: 3.7s
Precision: 64
\[\left(x \cdot x + \left(x \cdot 2\right) \cdot y\right) + y \cdot y\]
\[\mathsf{fma}\left(x, x, \left(x \cdot 2\right) \cdot y\right) + y \cdot y\]
\left(x \cdot x + \left(x \cdot 2\right) \cdot y\right) + y \cdot y
\mathsf{fma}\left(x, x, \left(x \cdot 2\right) \cdot y\right) + y \cdot y
double f(double x, double y) {
        double r735938 = x;
        double r735939 = r735938 * r735938;
        double r735940 = 2.0;
        double r735941 = r735938 * r735940;
        double r735942 = y;
        double r735943 = r735941 * r735942;
        double r735944 = r735939 + r735943;
        double r735945 = r735942 * r735942;
        double r735946 = r735944 + r735945;
        return r735946;
}

double f(double x, double y) {
        double r735947 = x;
        double r735948 = 2.0;
        double r735949 = r735947 * r735948;
        double r735950 = y;
        double r735951 = r735949 * r735950;
        double r735952 = fma(r735947, r735947, r735951);
        double r735953 = r735950 * r735950;
        double r735954 = r735952 + r735953;
        return r735954;
}

Error

Bits error versus x

Bits error versus y

Target

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

Derivation

  1. Initial program 0.0

    \[\left(x \cdot x + \left(x \cdot 2\right) \cdot y\right) + y \cdot y\]
  2. Using strategy rm
  3. Applied fma-def0.0

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

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

Reproduce

herbie shell --seed 2020060 +o rules:numerics
(FPCore (x y)
  :name "Examples.Basics.ProofTests:f4 from sbv-4.4"
  :precision binary64

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

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