Average Error: 0.0 → 0
Time: 3.6s
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 r61378 = x;
        double r61379 = r61378 * r61378;
        double r61380 = 2.0;
        double r61381 = r61379 * r61380;
        double r61382 = 1.0;
        double r61383 = r61381 - r61382;
        return r61383;
}

double f(double x) {
        double r61384 = x;
        double r61385 = 2.0;
        double r61386 = r61384 * r61385;
        double r61387 = 1.0;
        double r61388 = -r61387;
        double r61389 = fma(r61386, r61384, r61388);
        return r61389;
}

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