Average Error: 0.1 → 0.1
Time: 9.0s
Precision: 64
\[x \cdot \left(1 - x \cdot y\right)\]
\[\left(1 - x \cdot y\right) \cdot x + \mathsf{fma}\left(-y, x, x \cdot y\right) \cdot x\]
x \cdot \left(1 - x \cdot y\right)
\left(1 - x \cdot y\right) \cdot x + \mathsf{fma}\left(-y, x, x \cdot y\right) \cdot x
double f(double x, double y) {
        double r2616627 = x;
        double r2616628 = 1.0;
        double r2616629 = y;
        double r2616630 = r2616627 * r2616629;
        double r2616631 = r2616628 - r2616630;
        double r2616632 = r2616627 * r2616631;
        return r2616632;
}

double f(double x, double y) {
        double r2616633 = 1.0;
        double r2616634 = x;
        double r2616635 = y;
        double r2616636 = r2616634 * r2616635;
        double r2616637 = r2616633 - r2616636;
        double r2616638 = r2616637 * r2616634;
        double r2616639 = -r2616635;
        double r2616640 = fma(r2616639, r2616634, r2616636);
        double r2616641 = r2616640 * r2616634;
        double r2616642 = r2616638 + r2616641;
        return r2616642;
}

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 - y \cdot x\right)} + x \cdot \mathsf{fma}\left(-y, x, y \cdot x\right)\]
  7. Final simplification0.1

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

Reproduce

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