Average Error: 0.1 → 0.1
Time: 8.8s
Precision: 64
\[x \cdot \left(1 - x \cdot y\right)\]
\[x \cdot \left(\mathsf{fma}\left(x, -y, 1\right) + y \cdot \left(x \cdot 0\right)\right)\]
x \cdot \left(1 - x \cdot y\right)
x \cdot \left(\mathsf{fma}\left(x, -y, 1\right) + y \cdot \left(x \cdot 0\right)\right)
double f(double x, double y) {
        double r81226 = x;
        double r81227 = 1.0;
        double r81228 = y;
        double r81229 = r81226 * r81228;
        double r81230 = r81227 - r81229;
        double r81231 = r81226 * r81230;
        return r81231;
}

double f(double x, double y) {
        double r81232 = x;
        double r81233 = y;
        double r81234 = -r81233;
        double r81235 = 1.0;
        double r81236 = fma(r81232, r81234, r81235);
        double r81237 = 0.0;
        double r81238 = r81232 * r81237;
        double r81239 = r81233 * r81238;
        double r81240 = r81236 + r81239;
        double r81241 = r81232 * r81240;
        return r81241;
}

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-sqr-sqrt0.1

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

    \[\leadsto x \cdot \color{blue}{\left(\mathsf{fma}\left(\sqrt{1}, \sqrt{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(x, -y, 1\right)} + \mathsf{fma}\left(-y, x, y \cdot x\right)\right)\]
  6. Simplified0.1

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

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

Reproduce

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