Average Error: 0.1 → 0.1
Time: 2.7s
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 r73560 = x;
        double r73561 = 1.0;
        double r73562 = y;
        double r73563 = r73560 * r73562;
        double r73564 = r73561 - r73563;
        double r73565 = r73560 * r73564;
        return r73565;
}

double f(double x, double y) {
        double r73566 = x;
        double r73567 = 1.0;
        double r73568 = y;
        double r73569 = r73566 * r73568;
        double r73570 = r73567 - r73569;
        double r73571 = r73566 * r73570;
        double r73572 = -r73568;
        double r73573 = r73568 * r73566;
        double r73574 = fma(r73572, r73566, r73573);
        double r73575 = r73566 * r73574;
        double r73576 = r73571 + r73575;
        return r73576;
}

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

    \[\leadsto \color{blue}{x \cdot \mathsf{fma}\left(\sqrt{1}, \sqrt{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 2020062 +o rules:numerics
(FPCore (x y)
  :name "Numeric.SpecFunctions:log1p from math-functions-0.1.5.2, A"
  :precision binary64
  (* x (- 1 (* x y))))