Average Error: 0.1 → 0.1
Time: 12.4s
Precision: 64
\[x \cdot \left(1 - x \cdot y\right)\]
\[x \cdot \mathsf{fma}\left(\sqrt{1}, \sqrt{1}, -x \cdot y\right)\]
x \cdot \left(1 - x \cdot y\right)
x \cdot \mathsf{fma}\left(\sqrt{1}, \sqrt{1}, -x \cdot y\right)
double f(double x, double y) {
        double r73716 = x;
        double r73717 = 1.0;
        double r73718 = y;
        double r73719 = r73716 * r73718;
        double r73720 = r73717 - r73719;
        double r73721 = r73716 * r73720;
        return r73721;
}

double f(double x, double y) {
        double r73722 = x;
        double r73723 = 1.0;
        double r73724 = sqrt(r73723);
        double r73725 = y;
        double r73726 = r73722 * r73725;
        double r73727 = -r73726;
        double r73728 = fma(r73724, r73724, r73727);
        double r73729 = r73722 * r73728;
        return r73729;
}

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 fma-neg0.1

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

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

Reproduce

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