Average Error: 0.1 → 0.1
Time: 2.8s
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 r48734 = x;
        double r48735 = 1.0;
        double r48736 = y;
        double r48737 = r48734 * r48736;
        double r48738 = r48735 - r48737;
        double r48739 = r48734 * r48738;
        return r48739;
}

double f(double x, double y) {
        double r48740 = x;
        double r48741 = 1.0;
        double r48742 = y;
        double r48743 = r48740 * r48742;
        double r48744 = r48741 - r48743;
        double r48745 = r48740 * r48744;
        double r48746 = -r48742;
        double r48747 = r48742 * r48740;
        double r48748 = fma(r48746, r48740, r48747);
        double r48749 = r48740 * r48748;
        double r48750 = r48745 + r48749;
        return r48750;
}

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 2020089 +o rules:numerics
(FPCore (x y)
  :name "Numeric.SpecFunctions:log1p from math-functions-0.1.5.2, A"
  :precision binary64
  (* x (- 1 (* x y))))