Average Error: 0.0 → 0
Time: 6.3s
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 r45197 = x;
        double r45198 = r45197 * r45197;
        double r45199 = 2.0;
        double r45200 = r45198 * r45199;
        double r45201 = 1.0;
        double r45202 = r45200 - r45201;
        return r45202;
}

double f(double x) {
        double r45203 = x;
        double r45204 = 2.0;
        double r45205 = r45203 * r45204;
        double r45206 = 1.0;
        double r45207 = -r45206;
        double r45208 = fma(r45205, r45203, r45207);
        return r45208;
}

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