Average Error: 0.1 → 0.1
Time: 10.8s
Precision: binary64
Cost: 832
\[\left(\left(x \cdot x + y \cdot y\right) + y \cdot y\right) + y \cdot y \]
\[\left(y \cdot y\right) \cdot 4 - \left(y \cdot y - x \cdot x\right) \]
(FPCore (x y) :precision binary64 (+ (+ (+ (* x x) (* y y)) (* y y)) (* y y)))
(FPCore (x y) :precision binary64 (- (* (* y y) 4.0) (- (* y 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 * y) * 4.0) - ((y * 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 * y) * 4.0d0) - ((y * 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 * y) * 4.0) - ((y * y) - (x * x));
}
def code(x, y):
	return (((x * x) + (y * y)) + (y * y)) + (y * y)
def code(x, y):
	return ((y * y) * 4.0) - ((y * 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(Float64(y * y) * 4.0) - Float64(Float64(y * 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 * y) * 4.0) - ((y * 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[(N[(y * y), $MachinePrecision] * 4.0), $MachinePrecision] - N[(N[(y * y), $MachinePrecision] - N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\left(\left(x \cdot x + y \cdot y\right) + y \cdot y\right) + y \cdot y
\left(y \cdot y\right) \cdot 4 - \left(y \cdot y - x \cdot x\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. Applied egg-rr0.1

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

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

    \[\leadsto \color{blue}{\left(y \cdot y\right) \cdot 4 - \left(y \cdot y - x \cdot x\right)} \]

Alternatives

Alternative 1
Error0.1
Cost704
\[\left(y \cdot y\right) \cdot \left(2 + 1\right) + x \cdot x \]
Alternative 2
Error12.5
Cost584
\[\begin{array}{l} t_0 := \left(y \cdot 3\right) \cdot y\\ \mathbf{if}\;y \leq -1 \cdot 10^{-103}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y \leq 2.8 \cdot 10^{-51}:\\ \;\;\;\;x \cdot x\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 3
Error12.5
Cost584
\[\begin{array}{l} \mathbf{if}\;y \leq -4.8 \cdot 10^{-103}:\\ \;\;\;\;\left(y \cdot y\right) \cdot 3\\ \mathbf{elif}\;y \leq 7.2 \cdot 10^{-49}:\\ \;\;\;\;x \cdot x\\ \mathbf{else}:\\ \;\;\;\;\left(y \cdot 3\right) \cdot y\\ \end{array} \]
Alternative 4
Error0.2
Cost576
\[\frac{y \cdot y}{0.3333333333333333} + x \cdot x \]
Alternative 5
Error27.3
Cost192
\[x \cdot x \]

Error

Reproduce

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