Average Error: 0.0 → 0.0
Time: 1.2s
Precision: binary64
Cost: 448
\[\left(x \cdot x + y\right) + y\]
\[x \cdot x + \left(y + y\right)\]
\left(x \cdot x + y\right) + y
x \cdot x + \left(y + y\right)
(FPCore (x y) :precision binary64 (+ (+ (* x x) y) y))
(FPCore (x y) :precision binary64 (+ (* x x) (+ y y)))
double code(double x, double y) {
	return ((x * x) + y) + y;
}
double code(double x, double y) {
	return (x * x) + (y + y);
}

Error

Bits error versus x

Bits error versus y

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original0.0
Target0.0
Herbie0.0
\[\left(y + y\right) + x \cdot x\]

Alternatives

Alternative 1
Error0.0
Cost448
\[y + \left(x \cdot x + y\right)\]
Alternative 2
Error11.1
Cost520
\[\begin{array}{l} \mathbf{if}\;x \leq -8.211304125354037 \cdot 10^{+27} \lor \neg \left(x \leq 4.8045981740018336 \cdot 10^{+17}\right):\\ \;\;\;\;x \cdot x\\ \mathbf{else}:\\ \;\;\;\;y + y\\ \end{array}\]
Alternative 3
Error41.5
Cost192
\[x \cdot x\]
Alternative 4
Error61.4
Cost64
\[1\]

Error

Derivation

  1. Initial program 0.0

    \[\left(x \cdot x + y\right) + y\]
  2. Using strategy rm
  3. Applied associate-+l+_binary64_225170.0

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

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

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

Reproduce

herbie shell --seed 2021044 
(FPCore (x y)
  :name "Data.Random.Distribution.Normal:normalTail from random-fu-0.2.6.2"
  :precision binary64

  :herbie-target
  (+ (+ y y) (* x x))

  (+ (+ (* x x) y) y))