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 r48507 = x;
        double r48508 = r48507 * r48507;
        double r48509 = 2.0;
        double r48510 = r48508 * r48509;
        double r48511 = 1.0;
        double r48512 = r48510 - r48511;
        return r48512;
}

double f(double x) {
        double r48513 = x;
        double r48514 = 2.0;
        double r48515 = r48513 * r48514;
        double r48516 = 1.0;
        double r48517 = -r48516;
        double r48518 = fma(r48515, r48513, r48517);
        return r48518;
}

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