?

Average Error: 0.1 → 0.1
Time: 10.7s
Precision: binary64
Cost: 576

?

\[\left(\left(x \cdot x + y \cdot y\right) + y \cdot y\right) + y \cdot y \]
\[y \cdot \left(3 \cdot y\right) + x \cdot x \]
(FPCore (x y) :precision binary64 (+ (+ (+ (* x x) (* y y)) (* y y)) (* y y)))
(FPCore (x y) :precision binary64 (+ (* y (* 3.0 y)) (* x x)))
double code(double x, double y) {
	return (((x * x) + (y * y)) + (y * y)) + (y * y);
}
double code(double x, double y) {
	return (y * (3.0 * y)) + (x * x);
}
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 = (y * (3.0d0 * y)) + (x * x)
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 (y * (3.0 * y)) + (x * x);
}
def code(x, y):
	return (((x * x) + (y * y)) + (y * y)) + (y * y)
def code(x, y):
	return (y * (3.0 * y)) + (x * x)
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(y * Float64(3.0 * y)) + Float64(x * x))
end
function tmp = code(x, y)
	tmp = (((x * x) + (y * y)) + (y * y)) + (y * y);
end
function tmp = code(x, y)
	tmp = (y * (3.0 * y)) + (x * x);
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[(y * N[(3.0 * y), $MachinePrecision]), $MachinePrecision] + N[(x * x), $MachinePrecision]), $MachinePrecision]
\left(\left(x \cdot x + y \cdot y\right) + y \cdot y\right) + y \cdot y
y \cdot \left(3 \cdot y\right) + x \cdot x

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(y + \left(y + y\right)\right)} \]
    Proof

    [Start]0.1

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

    rational.json-simplify-1 [=>]0.1

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

    rational.json-simplify-1 [=>]0.1

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

    rational.json-simplify-41 [=>]0.1

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

    rational.json-simplify-41 [=>]0.1

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

    rational.json-simplify-51 [=>]0.1

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

    rational.json-simplify-51 [=>]0.1

    \[ x \cdot x + \color{blue}{y \cdot \left(y + \left(y + y\right)\right)} \]
  3. Applied egg-rr0.1

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

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

    [Start]0.1

    \[ \left(y \cdot \left(y \cdot 3\right) + x \cdot x\right) - 0 \]

    rational.json-simplify-5 [=>]0.1

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

    rational.json-simplify-43 [=>]0.1

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

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

Alternatives

Alternative 1
Error27.5
Cost320
\[3 \cdot \left(y \cdot y\right) \]

Error

Reproduce?

herbie shell --seed 2023074 
(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)))