Average Error: 0.0 → 0
Time: 4.3s
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 r5852975 = x;
        double r5852976 = r5852975 * r5852975;
        double r5852977 = r5852975 + r5852976;
        return r5852977;
}

double f(double x) {
        double r5852978 = x;
        double r5852979 = fma(r5852978, r5852978, r5852978);
        return r5852979;
}

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