Average Error: 38.4 → 0
Time: 23.2s
Precision: 64
\[\left(x + 1\right) \cdot \left(x + 1\right) - 1\]
\[\mathsf{fma}\left({x}^{\left(\frac{2}{2}\right)}, {x}^{\left(\frac{2}{2}\right)}, 2 \cdot x\right)\]
\left(x + 1\right) \cdot \left(x + 1\right) - 1
\mathsf{fma}\left({x}^{\left(\frac{2}{2}\right)}, {x}^{\left(\frac{2}{2}\right)}, 2 \cdot x\right)
double f(double x) {
        double r3193 = x;
        double r3194 = 1.0;
        double r3195 = r3193 + r3194;
        double r3196 = r3195 * r3195;
        double r3197 = r3196 - r3194;
        return r3197;
}

double f(double x) {
        double r3198 = x;
        double r3199 = 2.0;
        double r3200 = r3199 / r3199;
        double r3201 = pow(r3198, r3200);
        double r3202 = 2.0;
        double r3203 = r3202 * r3198;
        double r3204 = fma(r3201, r3201, r3203);
        return r3204;
}

Error

Bits error versus x

Derivation

  1. Initial program 38.4

    \[\left(x + 1\right) \cdot \left(x + 1\right) - 1\]
  2. Taylor expanded around 0 0.0

    \[\leadsto \color{blue}{{x}^{2} + 2 \cdot x}\]
  3. Simplified0.0

    \[\leadsto \color{blue}{x \cdot \left(x + 2\right)}\]
  4. Using strategy rm
  5. Applied distribute-lft-in0.0

    \[\leadsto \color{blue}{x \cdot x + x \cdot 2}\]
  6. Simplified0.0

    \[\leadsto \color{blue}{{x}^{2}} + x \cdot 2\]
  7. Simplified0.0

    \[\leadsto {x}^{2} + \color{blue}{2 \cdot x}\]
  8. Using strategy rm
  9. Applied sqr-pow0.0

    \[\leadsto \color{blue}{{x}^{\left(\frac{2}{2}\right)} \cdot {x}^{\left(\frac{2}{2}\right)}} + 2 \cdot x\]
  10. Applied fma-def0

    \[\leadsto \color{blue}{\mathsf{fma}\left({x}^{\left(\frac{2}{2}\right)}, {x}^{\left(\frac{2}{2}\right)}, 2 \cdot x\right)}\]
  11. Final simplification0

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

Reproduce

herbie shell --seed 2020043 +o rules:numerics
(FPCore (x)
  :name "Expanding a square"
  :precision binary64
  (- (* (+ x 1) (+ x 1)) 1))