Average Error: 0.0 → 0
Time: 2.0m
Precision: 64
\[x + x \cdot x\]
\[\mathsf{fma}\left(x, x, x\right)\]
x + x \cdot x
\mathsf{fma}\left(x, x, x\right)
double f(double x) {
        double r3611619 = x;
        double r3611620 = r3611619 * r3611619;
        double r3611621 = r3611619 + r3611620;
        return r3611621;
}

double f(double x) {
        double r3611622 = x;
        double r3611623 = fma(r3611622, r3611622, r3611622);
        return r3611623;
}

Error

Bits error versus x

Derivation

  1. Initial program 0.0

    \[x + x \cdot x\]
  2. Simplified0

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

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

Reproduce

herbie shell --seed 2019172 +o rules:numerics
(FPCore (x)
  :name "Main:bigenough1 from B"
  (+ x (* x x)))