Average Error: 0.1 → 0.1
Time: 4.0s
Precision: 64
\[x \cdot \left(1 - x \cdot y\right)\]
\[\left(1 - x \cdot y\right) \cdot x\]
x \cdot \left(1 - x \cdot y\right)
\left(1 - x \cdot y\right) \cdot x
double f(double x, double y) {
        double r80767 = x;
        double r80768 = 1.0;
        double r80769 = y;
        double r80770 = r80767 * r80769;
        double r80771 = r80768 - r80770;
        double r80772 = r80767 * r80771;
        return r80772;
}

double f(double x, double y) {
        double r80773 = 1.0;
        double r80774 = x;
        double r80775 = y;
        double r80776 = r80774 * r80775;
        double r80777 = r80773 - r80776;
        double r80778 = r80777 * r80774;
        return r80778;
}

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 *-commutative0.1

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

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

Reproduce

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