Average Error: 0.1 → 0.1
Time: 2.3s
Precision: 64
\[x \cdot \left(1 - x \cdot y\right)\]
\[x \cdot \left(1 - x \cdot y\right) + x \cdot \mathsf{fma}\left(-y, x, y \cdot x\right)\]
x \cdot \left(1 - x \cdot y\right)
x \cdot \left(1 - x \cdot y\right) + x \cdot \mathsf{fma}\left(-y, x, y \cdot x\right)
double f(double x, double y) {
        double r37040 = x;
        double r37041 = 1.0;
        double r37042 = y;
        double r37043 = r37040 * r37042;
        double r37044 = r37041 - r37043;
        double r37045 = r37040 * r37044;
        return r37045;
}

double f(double x, double y) {
        double r37046 = x;
        double r37047 = 1.0;
        double r37048 = y;
        double r37049 = r37046 * r37048;
        double r37050 = r37047 - r37049;
        double r37051 = r37046 * r37050;
        double r37052 = -r37048;
        double r37053 = r37048 * r37046;
        double r37054 = fma(r37052, r37046, r37053);
        double r37055 = r37046 * r37054;
        double r37056 = r37051 + r37055;
        return r37056;
}

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. Applied distribute-lft-in0.1

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

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

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

Reproduce

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