?

Average Error: 0.1 → 0.1
Time: 10.0s
Precision: binary64
Cost: 704

?

\[\left(\left(x \cdot x + y \cdot y\right) + y \cdot y\right) + y \cdot y \]
\[x \cdot x + y \cdot \left(\left(y + y\right) + y\right) \]
(FPCore (x y) :precision binary64 (+ (+ (+ (* x x) (* y y)) (* y y)) (* y y)))
(FPCore (x y) :precision binary64 (+ (* x x) (* y (+ (+ y y) y))))
double code(double x, double y) {
	return (((x * x) + (y * y)) + (y * y)) + (y * y);
}
double code(double x, double y) {
	return (x * x) + (y * ((y + y) + y));
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    code = (((x * x) + (y * y)) + (y * y)) + (y * y)
end function
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    code = (x * x) + (y * ((y + y) + y))
end function
public static double code(double x, double y) {
	return (((x * x) + (y * y)) + (y * y)) + (y * y);
}
public static double code(double x, double y) {
	return (x * x) + (y * ((y + y) + y));
}
def code(x, y):
	return (((x * x) + (y * y)) + (y * y)) + (y * y)
def code(x, y):
	return (x * x) + (y * ((y + y) + y))
function code(x, y)
	return Float64(Float64(Float64(Float64(x * x) + Float64(y * y)) + Float64(y * y)) + Float64(y * y))
end
function code(x, y)
	return Float64(Float64(x * x) + Float64(y * Float64(Float64(y + y) + y)))
end
function tmp = code(x, y)
	tmp = (((x * x) + (y * y)) + (y * y)) + (y * y);
end
function tmp = code(x, y)
	tmp = (x * x) + (y * ((y + y) + y));
end
code[x_, y_] := N[(N[(N[(N[(x * x), $MachinePrecision] + N[(y * y), $MachinePrecision]), $MachinePrecision] + N[(y * y), $MachinePrecision]), $MachinePrecision] + N[(y * y), $MachinePrecision]), $MachinePrecision]
code[x_, y_] := N[(N[(x * x), $MachinePrecision] + N[(y * N[(N[(y + y), $MachinePrecision] + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\left(\left(x \cdot x + y \cdot y\right) + y \cdot y\right) + y \cdot y
x \cdot x + y \cdot \left(\left(y + y\right) + y\right)

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

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

Derivation?

  1. Initial program 0.1

    \[\left(\left(x \cdot x + y \cdot y\right) + y \cdot y\right) + y \cdot y \]
  2. Simplified0.1

    \[\leadsto \color{blue}{x \cdot x + y \cdot \left(\left(y + y\right) + y\right)} \]
    Proof

    [Start]0.1

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

    rational_best-simplify-1 [=>]0.1

    \[ \color{blue}{y \cdot y + \left(\left(x \cdot x + y \cdot y\right) + y \cdot y\right)} \]

    rational_best-simplify-1 [=>]0.1

    \[ y \cdot y + \color{blue}{\left(y \cdot y + \left(x \cdot x + y \cdot y\right)\right)} \]

    rational_best-simplify-43 [=>]0.1

    \[ \color{blue}{\left(x \cdot x + y \cdot y\right) + \left(y \cdot y + y \cdot y\right)} \]

    rational_best-simplify-1 [=>]0.1

    \[ \color{blue}{\left(y \cdot y + y \cdot y\right) + \left(x \cdot x + y \cdot y\right)} \]

    rational_best-simplify-1 [=>]0.1

    \[ \left(y \cdot y + y \cdot y\right) + \color{blue}{\left(y \cdot y + x \cdot x\right)} \]

    rational_best-simplify-43 [=>]0.1

    \[ \color{blue}{x \cdot x + \left(y \cdot y + \left(y \cdot y + y \cdot y\right)\right)} \]

    rational_best-simplify-47 [=>]0.1

    \[ x \cdot x + \left(y \cdot y + \color{blue}{y \cdot \left(y + y\right)}\right) \]

    rational_best-simplify-47 [=>]0.1

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

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

Alternatives

Alternative 1
Error0.1
Cost576
\[x \cdot x + 3 \cdot \left(y \cdot y\right) \]
Alternative 2
Error28.1
Cost320
\[3 \cdot \left(y \cdot y\right) \]
Alternative 3
Error28.0
Cost320
\[y \cdot \left(3 \cdot y\right) \]

Error

Reproduce?

herbie shell --seed 2023094 
(FPCore (x y)
  :name "Linear.Quaternion:$c/ from linear-1.19.1.3, E"
  :precision binary64

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

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