Average Error: 0.0 → 0.0
Time: 1.5s
Precision: binary64
\[\left(x \cdot y + x\right) + y\]
\[x + \left(x + 1\right) \cdot y\]
\left(x \cdot y + x\right) + y
x + \left(x + 1\right) \cdot y
(FPCore (x y) :precision binary64 (+ (+ (* x y) x) y))
(FPCore (x y) :precision binary64 (+ x (* (+ x 1.0) y)))
double code(double x, double y) {
	return ((x * y) + x) + y;
}
double code(double x, double y) {
	return x + ((x + 1.0) * 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.0

    \[\left(x \cdot y + x\right) + y\]
  2. Taylor expanded around 0 0.0

    \[\leadsto \color{blue}{x \cdot y + \left(y + x\right)}\]
  3. Simplified0.0

    \[\leadsto \color{blue}{y + \left(y + 1\right) \cdot x}\]
  4. Taylor expanded around 0 0.0

    \[\leadsto \color{blue}{x + \left(x \cdot y + y\right)}\]
  5. Simplified0.0

    \[\leadsto \color{blue}{x + \left(y + x \cdot y\right)}\]
  6. Using strategy rm
  7. Applied distribute-rgt1-in_binary640.0

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

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

Alternatives

Reproduce

herbie shell --seed 2021110 
(FPCore (x y)
  :name "Numeric.Log:$cexpm1 from log-domain-0.10.2.1, B"
  :precision binary64
  (+ (+ (* x y) x) y))