Average Error: 0.0 → 0
Time: 6.1s
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 r35157 = x;
        double r35158 = r35157 * r35157;
        double r35159 = 2.0;
        double r35160 = r35158 * r35159;
        double r35161 = 1.0;
        double r35162 = r35160 - r35161;
        return r35162;
}

double f(double x) {
        double r35163 = x;
        double r35164 = 2.0;
        double r35165 = r35163 * r35164;
        double r35166 = 1.0;
        double r35167 = -r35166;
        double r35168 = fma(r35165, r35163, r35167);
        return r35168;
}

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))