Average Error: 0.1 → 0.1
Time: 3.2s
Precision: 64
\[x \cdot \left(1 - x \cdot y\right)\]
\[x \cdot \mathsf{fma}\left(-y, x, 1\right) + x \cdot \mathsf{fma}\left(-y, x, y \cdot x\right)\]
x \cdot \left(1 - x \cdot y\right)
x \cdot \mathsf{fma}\left(-y, x, 1\right) + x \cdot \mathsf{fma}\left(-y, x, y \cdot x\right)
double f(double x, double y) {
        double r69861 = x;
        double r69862 = 1.0;
        double r69863 = y;
        double r69864 = r69861 * r69863;
        double r69865 = r69862 - r69864;
        double r69866 = r69861 * r69865;
        return r69866;
}

double f(double x, double y) {
        double r69867 = x;
        double r69868 = y;
        double r69869 = -r69868;
        double r69870 = 1.0;
        double r69871 = fma(r69869, r69867, r69870);
        double r69872 = r69867 * r69871;
        double r69873 = r69868 * r69867;
        double r69874 = fma(r69869, r69867, r69873);
        double r69875 = r69867 * r69874;
        double r69876 = r69872 + r69875;
        return r69876;
}

Error

Bits error versus x

Bits error versus y

Derivation

  1. Initial program 0.1

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

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

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

    \[\leadsto x \cdot \left(\color{blue}{\mathsf{fma}\left(-y, x, {\left(\sqrt[3]{1}\right)}^{3}\right)} + \mathsf{fma}\left(-y, x, y \cdot x\right)\right)\]
  6. Using strategy rm
  7. Applied distribute-lft-in0.1

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

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

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

Reproduce

herbie shell --seed 2020035 +o rules:numerics
(FPCore (x y)
  :name "Numeric.SpecFunctions:log1p from math-functions-0.1.5.2, A"
  :precision binary64
  (* x (- 1 (* x y))))