Average Error: 0.0 → 0
Time: 5.8s
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 r38917 = x;
        double r38918 = r38917 * r38917;
        double r38919 = 2.0;
        double r38920 = r38918 * r38919;
        double r38921 = 1.0;
        double r38922 = r38920 - r38921;
        return r38922;
}

double f(double x) {
        double r38923 = x;
        double r38924 = 2.0;
        double r38925 = r38923 * r38924;
        double r38926 = 1.0;
        double r38927 = -r38926;
        double r38928 = fma(r38925, r38923, r38927);
        return r38928;
}

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}{0}\]
  7. Final simplification0

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

Reproduce

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