Average Error: 0.0 → 0.0
Time: 19.1s
Precision: 64
\[0.0 \le x \le 2\]
\[x \cdot \left(x \cdot x\right) + x \cdot x\]
\[\mathsf{fma}\left(x, x, x\right) \cdot x\]
x \cdot \left(x \cdot x\right) + x \cdot x
\mathsf{fma}\left(x, x, x\right) \cdot x
double f(double x) {
        double r4197929 = x;
        double r4197930 = r4197929 * r4197929;
        double r4197931 = r4197929 * r4197930;
        double r4197932 = r4197931 + r4197930;
        return r4197932;
}

double f(double x) {
        double r4197933 = x;
        double r4197934 = fma(r4197933, r4197933, r4197933);
        double r4197935 = r4197934 * r4197933;
        return r4197935;
}

Error

Bits error versus x

Target

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

Derivation

  1. Initial program 0.0

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

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

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

Reproduce

herbie shell --seed 2019200 +o rules:numerics
(FPCore (x)
  :name "Expression 3, p15"
  :pre (<= 0.0 x 2.0)

  :herbie-target
  (* (* (+ 1.0 x) x) x)

  (+ (* x (* x x)) (* x x)))