Average Error: 0.0 → 0
Time: 3.2s
Precision: 64
\[\left(x \cdot x\right) \cdot 2 - 1\]
\[\mathsf{fma}\left(x \cdot 2, x, -1\right) + \left(1 - 1\right)\]
\left(x \cdot x\right) \cdot 2 - 1
\mathsf{fma}\left(x \cdot 2, x, -1\right) + \left(1 - 1\right)
double f(double x) {
        double r29052 = x;
        double r29053 = r29052 * r29052;
        double r29054 = 2.0;
        double r29055 = r29053 * r29054;
        double r29056 = 1.0;
        double r29057 = r29055 - r29056;
        return r29057;
}

double f(double x) {
        double r29058 = x;
        double r29059 = 2.0;
        double r29060 = r29058 * r29059;
        double r29061 = 1.0;
        double r29062 = -r29061;
        double r29063 = fma(r29060, r29058, r29062);
        double r29064 = r29061 - r29061;
        double r29065 = r29063 + r29064;
        return r29065;
}

Error

Bits error versus x

Derivation

  1. Initial program 0.0

    \[\left(x \cdot x\right) \cdot 2 - 1\]
  2. Using strategy rm
  3. Applied add-cube-cbrt0.0

    \[\leadsto \left(x \cdot x\right) \cdot 2 - \color{blue}{\left(\sqrt[3]{1} \cdot \sqrt[3]{1}\right) \cdot \sqrt[3]{1}}\]
  4. Applied prod-diff0.0

    \[\leadsto \color{blue}{\mathsf{fma}\left(x \cdot x, 2, -\sqrt[3]{1} \cdot \left(\sqrt[3]{1} \cdot \sqrt[3]{1}\right)\right) + \mathsf{fma}\left(-\sqrt[3]{1}, \sqrt[3]{1} \cdot \sqrt[3]{1}, \sqrt[3]{1} \cdot \left(\sqrt[3]{1} \cdot \sqrt[3]{1}\right)\right)}\]
  5. Simplified0

    \[\leadsto \color{blue}{\mathsf{fma}\left(x \cdot 2, x, -1\right)} + \mathsf{fma}\left(-\sqrt[3]{1}, \sqrt[3]{1} \cdot \sqrt[3]{1}, \sqrt[3]{1} \cdot \left(\sqrt[3]{1} \cdot \sqrt[3]{1}\right)\right)\]
  6. Simplified0

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

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

Reproduce

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