Average Error: 0.1 → 0.1
Time: 9.0s
Precision: 64
\[x \cdot \left(1 - x \cdot y\right)\]
\[1 \cdot x + \left(-x \cdot y\right) \cdot x\]
x \cdot \left(1 - x \cdot y\right)
1 \cdot x + \left(-x \cdot y\right) \cdot x
double f(double x, double y) {
        double r58630 = x;
        double r58631 = 1.0;
        double r58632 = y;
        double r58633 = r58630 * r58632;
        double r58634 = r58631 - r58633;
        double r58635 = r58630 * r58634;
        return r58635;
}

double f(double x, double y) {
        double r58636 = 1.0;
        double r58637 = x;
        double r58638 = r58636 * r58637;
        double r58639 = y;
        double r58640 = r58637 * r58639;
        double r58641 = -r58640;
        double r58642 = r58641 * r58637;
        double r58643 = r58638 + r58642;
        return r58643;
}

Error

Bits error versus x

Bits error versus y

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 0.1

    \[x \cdot \left(1 - x \cdot y\right)\]
  2. Using strategy rm
  3. Applied sub-neg0.1

    \[\leadsto x \cdot \color{blue}{\left(1 + \left(-x \cdot y\right)\right)}\]
  4. Applied distribute-rgt-in0.1

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

    \[\leadsto 1 \cdot x + \left(-x \cdot y\right) \cdot x\]

Reproduce

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