Average Error: 0.0 → 0
Time: 2.1m
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 r5398663 = x;
        double r5398664 = r5398663 * r5398663;
        double r5398665 = r5398663 + r5398664;
        return r5398665;
}

double f(double x) {
        double r5398666 = x;
        double r5398667 = fma(r5398666, r5398666, r5398666);
        return r5398667;
}

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 2019158 +o rules:numerics
(FPCore (x)
  :name "Main:bigenough1 from B"
  (+ x (* x x)))