Average Error: 0.1 → 0.1
Time: 3.8s
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 r52221 = x;
        double r52222 = 1.0;
        double r52223 = y;
        double r52224 = r52221 * r52223;
        double r52225 = r52222 - r52224;
        double r52226 = r52221 * r52225;
        return r52226;
}

double f(double x, double y) {
        double r52227 = 1.0;
        double r52228 = x;
        double r52229 = y;
        double r52230 = r52228 * r52229;
        double r52231 = r52227 - r52230;
        double r52232 = r52231 * r52228;
        return r52232;
}

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