Average Error: 0.1 → 0.1
Time: 1.8s
Precision: 64
\[x \cdot \left(1 - x \cdot y\right)\]
\[\frac{x \cdot \left(1 + x \cdot y\right)}{\frac{1 + x \cdot y}{1 - x \cdot y}}\]
x \cdot \left(1 - x \cdot y\right)
\frac{x \cdot \left(1 + x \cdot y\right)}{\frac{1 + x \cdot y}{1 - x \cdot y}}
double code(double x, double y) {
	return (x * (1.0 - (x * y)));
}
double code(double x, double y) {
	return ((x * (1.0 + (x * y))) / ((1.0 + (x * y)) / (1.0 - (x * y))));
}

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 flip--5.5

    \[\leadsto x \cdot \color{blue}{\frac{1 \cdot 1 - \left(x \cdot y\right) \cdot \left(x \cdot y\right)}{1 + x \cdot y}}\]
  4. Applied associate-*r/8.3

    \[\leadsto \color{blue}{\frac{x \cdot \left(1 \cdot 1 - \left(x \cdot y\right) \cdot \left(x \cdot y\right)\right)}{1 + x \cdot y}}\]
  5. Using strategy rm
  6. Applied difference-of-squares8.3

    \[\leadsto \frac{x \cdot \color{blue}{\left(\left(1 + x \cdot y\right) \cdot \left(1 - x \cdot y\right)\right)}}{1 + x \cdot y}\]
  7. Applied associate-*r*7.5

    \[\leadsto \frac{\color{blue}{\left(x \cdot \left(1 + x \cdot y\right)\right) \cdot \left(1 - x \cdot y\right)}}{1 + x \cdot y}\]
  8. Applied associate-/l*0.1

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

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

Reproduce

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