Average Error: 0.0 → 0.0
Time: 6.3s
Precision: 64
\[\left(x \cdot 2.0 + x \cdot x\right) + y \cdot y\]
\[\mathsf{fma}\left(y, y, x \cdot \left(2.0 + x\right)\right)\]
\left(x \cdot 2.0 + x \cdot x\right) + y \cdot y
\mathsf{fma}\left(y, y, x \cdot \left(2.0 + x\right)\right)
double f(double x, double y) {
        double r23189220 = x;
        double r23189221 = 2.0;
        double r23189222 = r23189220 * r23189221;
        double r23189223 = r23189220 * r23189220;
        double r23189224 = r23189222 + r23189223;
        double r23189225 = y;
        double r23189226 = r23189225 * r23189225;
        double r23189227 = r23189224 + r23189226;
        return r23189227;
}

double f(double x, double y) {
        double r23189228 = y;
        double r23189229 = x;
        double r23189230 = 2.0;
        double r23189231 = r23189230 + r23189229;
        double r23189232 = r23189229 * r23189231;
        double r23189233 = fma(r23189228, r23189228, r23189232);
        return r23189233;
}

Error

Bits error versus x

Bits error versus y

Target

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

Derivation

  1. Initial program 0.0

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

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

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

Reproduce

herbie shell --seed 2019158 +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)))