Average Error: 0.0 → 0
Time: 5.5s
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 r21396 = x;
        double r21397 = r21396 * r21396;
        double r21398 = 2.0;
        double r21399 = r21397 * r21398;
        double r21400 = 1.0;
        double r21401 = r21399 - r21400;
        return r21401;
}

double f(double x) {
        double r21402 = x;
        double r21403 = 2.0;
        double r21404 = r21402 * r21403;
        double r21405 = 1.0;
        double r21406 = -r21405;
        double r21407 = fma(r21404, r21402, r21406);
        return r21407;
}

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