Average Error: 0.0 → 0
Time: 5.9s
Precision: 64
\[\left(x \cdot x\right) \cdot 2 - 1\]
\[\mathsf{fma}\left(x \cdot 2, x, -1\right)\]
\left(x \cdot x\right) \cdot 2 - 1
\mathsf{fma}\left(x \cdot 2, x, -1\right)
double f(double x) {
        double r29600 = x;
        double r29601 = r29600 * r29600;
        double r29602 = 2.0;
        double r29603 = r29601 * r29602;
        double r29604 = 1.0;
        double r29605 = r29603 - r29604;
        return r29605;
}

double f(double x) {
        double r29606 = x;
        double r29607 = 2.0;
        double r29608 = r29606 * r29607;
        double r29609 = 1.0;
        double r29610 = -r29609;
        double r29611 = fma(r29608, r29606, r29610);
        return r29611;
}

Error

Bits error versus x

Derivation

  1. Initial program 0.0

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

    \[\leadsto \color{blue}{2 \cdot {x}^{2} - 1}\]
  3. Simplified0

    \[\leadsto \color{blue}{\mathsf{fma}\left(x \cdot 2, x, -1\right)}\]
  4. Final simplification0

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

Reproduce

herbie shell --seed 2019303 +o rules:numerics
(FPCore (x)
  :name "Numeric.SpecFunctions:logGammaCorrection from math-functions-0.1.5.2"
  :precision binary64
  (- (* (* x x) 2) 1))