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 r47366 = x;
        double r47367 = r47366 * r47366;
        double r47368 = 2.0;
        double r47369 = r47367 * r47368;
        double r47370 = 1.0;
        double r47371 = r47369 - r47370;
        return r47371;
}

double f(double x) {
        double r47372 = x;
        double r47373 = 2.0;
        double r47374 = r47372 * r47373;
        double r47375 = 1.0;
        double r47376 = -r47375;
        double r47377 = fma(r47374, r47372, r47376);
        return r47377;
}

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 2019323 +o rules:numerics
(FPCore (x)
  :name "Numeric.SpecFunctions:logGammaCorrection from math-functions-0.1.5.2"
  :precision binary64
  (- (* (* x x) 2) 1))