?

Average Error: 39.4 → 0.0
Time: 2.7s
Precision: binary64
Cost: 6784

?

\[\left(x + 1\right) \cdot \left(x + 1\right) - 1 \]
\[2 \cdot x + {x}^{2} \]
(FPCore (x) :precision binary64 (- (* (+ x 1.0) (+ x 1.0)) 1.0))
(FPCore (x) :precision binary64 (+ (* 2.0 x) (pow x 2.0)))
double code(double x) {
	return ((x + 1.0) * (x + 1.0)) - 1.0;
}
double code(double x) {
	return (2.0 * x) + pow(x, 2.0);
}
real(8) function code(x)
    real(8), intent (in) :: x
    code = ((x + 1.0d0) * (x + 1.0d0)) - 1.0d0
end function
real(8) function code(x)
    real(8), intent (in) :: x
    code = (2.0d0 * x) + (x ** 2.0d0)
end function
public static double code(double x) {
	return ((x + 1.0) * (x + 1.0)) - 1.0;
}
public static double code(double x) {
	return (2.0 * x) + Math.pow(x, 2.0);
}
def code(x):
	return ((x + 1.0) * (x + 1.0)) - 1.0
def code(x):
	return (2.0 * x) + math.pow(x, 2.0)
function code(x)
	return Float64(Float64(Float64(x + 1.0) * Float64(x + 1.0)) - 1.0)
end
function code(x)
	return Float64(Float64(2.0 * x) + (x ^ 2.0))
end
function tmp = code(x)
	tmp = ((x + 1.0) * (x + 1.0)) - 1.0;
end
function tmp = code(x)
	tmp = (2.0 * x) + (x ^ 2.0);
end
code[x_] := N[(N[(N[(x + 1.0), $MachinePrecision] * N[(x + 1.0), $MachinePrecision]), $MachinePrecision] - 1.0), $MachinePrecision]
code[x_] := N[(N[(2.0 * x), $MachinePrecision] + N[Power[x, 2.0], $MachinePrecision]), $MachinePrecision]
\left(x + 1\right) \cdot \left(x + 1\right) - 1
2 \cdot x + {x}^{2}

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation?

  1. Initial program 39.4

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

    \[\leadsto \color{blue}{2 \cdot x + {x}^{2}} \]
  3. Final simplification0.0

    \[\leadsto 2 \cdot x + {x}^{2} \]

Alternatives

Alternative 1
Error0.6
Cost1096
\[\begin{array}{l} t_0 := \left(x + 1\right) \cdot \left(x + 1\right) - 1\\ \mathbf{if}\;x + 1 \leq -2:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x + 1 \leq 1.0000001:\\ \;\;\;\;2 \cdot x\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 2
Error21.1
Cost192
\[2 \cdot x \]

Error

Reproduce?

herbie shell --seed 2023096 
(FPCore (x)
  :name "Expanding a square"
  :precision binary64
  (- (* (+ x 1.0) (+ x 1.0)) 1.0))