Average Error: 0.0 → 0.0
Time: 5.9s
Precision: 64
\[\left(x \cdot 2 + x \cdot x\right) + y \cdot y\]
\[\mathsf{fma}\left(y, y, x \cdot \left(2 + x\right)\right)\]
\left(x \cdot 2 + x \cdot x\right) + y \cdot y
\mathsf{fma}\left(y, y, x \cdot \left(2 + x\right)\right)
double f(double x, double y) {
        double r279061 = x;
        double r279062 = 2.0;
        double r279063 = r279061 * r279062;
        double r279064 = r279061 * r279061;
        double r279065 = r279063 + r279064;
        double r279066 = y;
        double r279067 = r279066 * r279066;
        double r279068 = r279065 + r279067;
        return r279068;
}

double f(double x, double y) {
        double r279069 = y;
        double r279070 = x;
        double r279071 = 2.0;
        double r279072 = r279071 + r279070;
        double r279073 = r279070 * r279072;
        double r279074 = fma(r279069, r279069, r279073);
        return r279074;
}

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(y, y, \left(2 + x\right) \cdot x\right)}\]
  3. Final simplification0.0

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

Reproduce

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

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

  (+ (+ (* x 2.0) (* x x)) (* y y)))